Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

global header file

29 views
Skip to first unread message

Chris Cranford

unread,
Dec 31, 2000, 6:33:41 PM12/31/00
to
Is there a place I can put an include file statement where it will be
affective for ALL classes in my project? I have a header file which gives
me the definations to multiple DLL files which may be called at any point
within the VC++ execution. I didn't know if there was such a way to define
global header files.

Chris


Sam Hobbs

unread,
Dec 31, 2000, 10:06:26 PM12/31/00
to
stdafx.h?

"Chris Cranford" <chris.c...@tkdsoftware.com> wrote in message
news:pnP36.63838$sr6.10...@typhoon.southeast.rr.com...

Joseph M. Newcomer

unread,
Jan 1, 2001, 2:29:26 PM1/1/01
to
Mostly, global header files are big losers. You should include in
stdafx.h only those files which are essentially "constant", and rarely
if ever change. Otherwise, you trigger a lot of gratuitous
recompilations. I find that I *rarely* have any DLL that is called
from *every* module, so doing a #include in the modules that use it is
not onerous. Putting the #include in each file that uses it costs
virtually nothing, and creates programs that have a lower maintenance
cost than programs that have either one massive header file or one
which implicitly includes dozens of other header files. The only thing
stdafx is really good for is the "constant" Windows, C, and MFC
headers that essentially never change; this buys you the ability to do
utilize precompiled headers effectively. There is no merit in dumping
all these files into one global include file. In fact, it is actually
counterproductive.

btw, if anyone believes that global header files make sense, check out
Ellen Borison's PhD dissertation, "Program Changes and the Cost of
Selective Recompilation", CMU Computer Science, 1989. I always felt
intuitively they were a completely losing idea, but she has the data
to back up this claim. I can now say with some authority that they are
a losing idea (I was also on her PhD thesis committee).

"If it doesn't have numbers, it ain't science, it's opinion" (R. A.
Heinlein, writing as his character "Lazarus Long")
joe

Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm

0 new messages