Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!hplabs!hplabsz!davis From: davis@hplabsz.HPL.HP.COM (Jim Davis) Newsgroups: comp.lang.c Subject: Re: Directives in comments Message-ID: <4561@hplabsz.HPL.HP.COM> Date: 29 Dec 89 02:11:45 GMT References: <25234@cup.portal.com> <1989Dec22.084628.7201@cs.eur.nl> Reply-To: davis@hplabs.hp.com (Jim Davis) Organization: Hewlett-Packard Laboratories Lines: 29 David H Close wrote: dhc> [...text deleted...] This appears to be consistent with K&R (1978), ... dhc> The following program fragment appears to conform to the rules stated. dhc> /* dhc> * Program heading dhc> #define hdr "Program name" dhc> * end of heading dhc> */ dhc> main () { printf(hdr); } dhc> K&R's assertion that directives "have syntax independent of the dhc> rest of the language" would appear to me to allow the example. Reino de Boer quite correctly replied: rdb> In K&R Second Edition pp. 228--229, A12. Preprocessing: rdb> 3. The program is split into tokens separated by white-space rdb> characters; comments are replaced by a single space. Then rdb> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^(only then) rdb> preprocessing directives are obeyed, and macros (...) are expanded. rdb> Hope this explains -- Reino I would add one more nit. The example presented does not have "lines beginning with a #". The "#define" was indented. The '#' symbol must not (at least in the compilers I am familliar with) be preceeded by whitespace. -- Jim Davis (James W. Davis) Palo Alto, CA (415)857-4036 davis@hplabs.hp.com {any_of_the_biggies}!hplabs!davis