#ifdef
Henry Spencer
henry at utzoo.uucp
Thu Dec 7 05:16:53 AEST 1989
In article <9326 at microsoft.UUCP> azeemk at microsoft.UUCP (Azeem Kahn) writes:
>/*
>#endif
>*/
>I want to know what the standard says about this. I am not interested
>in what some systems do and others don't.
Section 2.1.1.2, Oct 1988 draft (still current except for wording changes),
says comment elimination happens first, so that #endif is never seen.
In case people are interested, 2.1.1.2 defines eight translation phases,
to specify the order in which things happen. Abbreviated, they are:
1. Any funny character-code translations are done, and trigraphs interpreted.
2. Newlines immediately preceded by backslashes vanish.
3. Source turns into preprocessing tokens; comments vanish.
4. Preprocessing, including running #included files through phases 1-4.
5. Character constants and string literals translated to target character set,
including interpretation of escape sequences.
6. Concatenation of adjacent string literals.
7. White space vanishes, preprocessing tokens become tokens; compilation.
8. Linking.
In case anyone hasn't heard about preprocessing tokens, they are pretty
much ordinary tokens except that white space and newlines are tokens
(because they matter to the preprocessor in certain situations) and the
syntax of numbers is rather vague and general (because one of the putrid
operators involved in macro expansion -- whose only virtue is that it's
a bit less putrid than the Reiserism that it replaces -- can glue two
pptokens together into one, so one cannot be too fussy about token
syntax until after such abominations have finished their dirty work).
--
1233 EST, Dec 7, 1972: | Henry Spencer at U of Toronto Zoology
last ship sails for the Moon. | uunet!attcan!utzoo!henry henry at zoo.toronto.edu
More information about the Comp.std.c
mailing list