Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!goanna!ok From: ok@goanna.oz.au (Richard O'keefe) Newsgroups: comp.lang.c Subject: Re: Re^2: Why nested comments not allowed? Summary: ANSI rule Message-ID: <2899@goanna.oz.au> Date: 22 Feb 90 04:50:55 GMT References: <1523@wacsvax.OZ> <13706@cbnewsc.ATT.COM> <4286@jhunix.HCF.JHU.EDU> <5372@ur-cc.UUCP> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 23 In article <5372@ur-cc.UUCP>, misu_ss@uhura.cc.rochester.edu (What`s in a name?) writes: > This leads me to a question on how compilers work... > Do #defines get worked out before comments are discarded... It is quite explicit in ANSI C that comments are turned into spaces before any preprocessor directives are recognised or processed. In older C systems, particularly ones based on the "Reiser" preprocessor, this wasn't true, but portable code never could exploit it so we haven't lost anything. A consequence of the ANSI rules is that #define OPEN_COMMENT /* extern int fred[]; /* static */ int tom[2]; acts exactly like #define OPEN_COMMENT int tom[2]; If you want to do hairy things with comments and macros, M4 comes as part of the UNIX toolkit, and there's a PD implementation in C.