Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!samsung!zaphod.mps.ohio-state.edu!usc!snorkelwacker!bloom-beacon!eru!luth!sunic!mcsun!hp4nl!eurtrx!euraiv1!reino From: reino@cs.eur.nl (Reino de Boer) Newsgroups: comp.lang.c Subject: Re: Directives in comments Message-ID: <1989Dec22.084628.7201@cs.eur.nl> Date: 22 Dec 89 08:46:28 GMT References: <25234@cup.portal.com> Organization: Erasmus Universiteit Rotterdam, dept. CS (Informatica) Lines: 32 compata@cup.portal.com (David H Close) writes: >[...text deleted...] This appears >to be consistent with K&R (1978), which states on page 207, "These lines >[beginning with a #] have syntax independent of the rest of the language; >they may appear anywhere and have effect which lasts (independent of scope) >until the end of the source program file." >The following program fragment appears to conform to the rules stated. > /* > * Program heading > #define hdr "Program name" > * end of heading > */ > main () { printf(hdr); } >K&R's assertion that directives "have syntax independent of the rest of >the language" would appear to me to allow the example. In K&R Second Edition pp. 228--229, A12. Preprocessing: 3. The program is split into tokens separated by white-space characters; comments are replaced by a single space. Then ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^(only then) preprocessing directives are obeyed, and macros (...) are expanded. Hope this explains -- Reino -- Reino R. A. de Boer Erasmus University Rotterdam ( Informatica ) e-mail: reino@cs.eur.nl