Directives in comments
P E Smee
exspes at gdr.bath.ac.uk
Fri Dec 22 21:12:13 AEST 1989
In article <25234 at cup.portal.com> compata at cup.portal.com (David H Close) writes:
>The following program fragment appears to conform to the rules stated.
>
> /*
> * Program heading
> #define hdr "Program name"
> * end of heading
> */
> main () { printf(hdr); }
>
>However, the SCO compiler produces the following error message.
>
> t.c(6) : error 65: 'hdr' : undefined
Common folklore has it that comments are stripped out (and always have
been) BEFORE the preprocessor sets to work, so that your #define
disappears before the preprocessor sees it. However, I can't find
anything in either K&R-1 or K&R-2 which specifically SAYS that. The
behaviour you mention certainly doesn't surprise me, though.
--
Paul Smee, Univ of Bristol Comp Centre, Bristol BS8 1TW, Tel +44 272 303132
Smee at bristol.ac.uk :-) (..!uunet!ukc!gdr.bath.ac.uk!exspes if you MUST)
More information about the Comp.lang.c
mailing list