A question on C programming style

Ken Lerman lerman at stpstn.UUCP
Fri Apr 19 22:32:01 AEST 1991


In article <1848 at bbxsda.UUCP> scott at bbxsda.UUCP (Scott Amspoker) writes:
|>In article <12060 at dog.ee.lbl.gov> torek at elf.ee.lbl.gov (Chris Torek) writes:
|>>Indeed.  One thing, for which I argued (and still will argue---it
|>>seems `right' to me) which is not standard, would tip the balance
|>>all the way:  I believe that `#include' should (always) have been
|>>defined as `read this if you have not already'.
|>
|>Turbo C has an option to do exactly that.
|>

Objective-C uses #import to mean `read this if you have not already'.
#include has its usual meaning (which is sometimes useful).

There remains the question of what does it mean to say a file has
already been included.  One with the same name?  With the same path
and name?  With the same inode (on the same file system)?  With the
same contents?

For (IMHO) reasons having to do with where searches take place when
the included files is expressed as "filename.h" (instead of
<filename.h>) importing files with the same name (ignoring the path)
only once seems to be the right answer.

Ken



More information about the Comp.lang.c mailing list