(ref.doc)tsai 010893

Next maxtal 010893a Prev: grumpy 010893 Up: Usenet

Newsgroups: comp.lang.c++
From: [email protected] (Jodi Tsai)
Subject: Re: Include file dependencies
Keywords: include,dependencies
Organization: Vitesse Semiconductor Corporation
Date: Sun, 1 Aug 93 21:31:21 GMT

In article <[email protected]> [email protected] (Andrew Lighten) writes:
>Hi!
>
>I'd be interested to hear about how other people handle include file
>dependencies. Although C++ theoretically hides implementation details
>from the application, this isn't quite true when you include the header
>for a class, and this header requires additional definitions.
  .
  .
  .
>Is nested include files the recommended solution? I suspect that it is,
>but I don't know that I quite feel good about that. I think that makefile
>maintenance could become a problem in a class library with lots of headers
>and objects.
>
>Any comments?


As far as source code and headers go, I just use guards in all my
header files, and design every include file to be self-contained by
making sure that an include file #includes every include file it needs
to compile.  I find that this minimizes the amount of compiler
problems.

One nice thing about Sun's make is that it has the .KEEP_STATE: target
to do include dependency checking automatically.  In fact, I use Sun
make even for non Sun platforms just to take advantage of that
feature.

I wish GNU make had that also, it's the only reason why I can't use
GNU make.  If anyone knows a version of GNU make which has something
like .KEEP_STATE: please tell me!

You can use "makedepend" also, but I found that to be inconvenient in
comparison to Sun make because you have to rerun it every time your
include dependencies change. Sun make figures all that out and updates
.make.state whenever necessary.

Another disadvantage of makedepend is that it appends stuff to your
Makefile, so if you check your Makefiles into SCCS and your files are
read only, life becomes more difficult.

-- 
| Jodi Tsai   | Vitesse Semiconductor Corporation | e-mail: [email protected] |
|             | 741 Calle Plano                   | Voice: (805) 389-7121    |
|             | Camarillo, CA 93012               | FAX:   (805) 389-7126    |


automatically generated by info2www version 1.2.2.8