A solution to the multiple inclusio
mcdonald at uxe.cso.uiuc.edu
mcdonald at uxe.cso.uiuc.edu
Mon Oct 30 04:08:00 AEST 1989
> > #include FRED_H
> Please be alert for problems. K&R requires the token after the
> "#include" to be a filename enclosed in double quotes or angle
> brackets, not an arbitrary symbol.
Quoted without permission from "The C Programming Language" by
Kernighan and Ritchie, Prentice Hall, copyright 1988 (page231):
Finally, a directive of the form
# include token-sequence
not matching one of the previous formsis interpreted by expanding the
token sequence as for normal text; one of the two forms with
<...> or "..." must result, and it is then treated as described
previously"
So, if FRED_H expands to "fred.h" it is perfectly legal. If is stays
as-is, it is illegal.
Another question arises: earlier K&R say "The characters in the filename
must not include > [if it started with <] or the newline and
the effect in undefined if it
contains any of ", ',\, or /*."
Shouldn't that be "implementation defined" rather than undefined -
the most common operating system in the world uses "\" as a file
path separator.
Doug McDonald
More information about the Comp.lang.c
mailing list