Nesting of a preprocessor directive within a macro defn

Henry Spencer henry at zoo.toronto.edu
Sun Sep 2 12:20:39 AEST 1990


In article <849 at gtenmc.UUCP> ravim at gtenmc.UUCP (Ravi Kumar Mandava) writes:
>Is nesting of a preprocessor directive within a macro definition (RHS) not
>allowed?

It is not possible.  The very first thing that happens to ANSI C source
during compilation is that backslashed newlines are stripped out, so any
"#" within the RHS is no longer at the start of a line and hence does
not begin a preprocessor directive.

(And incidentally, the result of macro expansion "is not processed as a
preprocessing directive even if it resembles one", section 3.8.3.4.)

Some old C compilers may have permitted such things, due to the vagueness
of the old definition of how the preprocessor features interacted.
-- 
TCP/IP: handling tomorrow's loads today| Henry Spencer at U of Toronto Zoology
OSI: handling yesterday's loads someday|  henry at zoo.toronto.edu   utzoo!henry



More information about the Comp.lang.c mailing list