Question about ANSI preprocessor
Larry Jones
scjones at sdrc.UUCP
Fri Sep 29 08:30:57 AEST 1989
In article <10879 at riks.csl.sony.co.jp>, diamond at csl.sony.co.jp (Norman Diamond) writes:
> According to the ANSI standard, does the following code cause
> expansion of the preprocessor macro "huh"?
>
> #define huh(x) (abc + (x))
>
> y = huh
> #if 0
> , a, lot, of, garbage
> #endif
> (z);
No. Section 3.8.3 (Macro replacement) talks about function-like
macros and says:
Each subsequent instance of the function-like macro name
followed by a ( as the next preprocessing token
introduces the sequence of proprocessing tokens that is
replaced by the replacement list in the definition (an
invocation of the macro).
In this case, the preprocessing token following the macro name is
"#" rather than "(", so it is not eligable for expansion.
----
Larry Jones UUCP: uunet!sdrc!scjones
SDRC scjones at SDRC.UU.NET
2000 Eastman Dr. BIX: ltl
Milford, OH 45150-2789 AT&T: (513) 576-2070
"I have plenty of good sense. I just choose to ignore it."
-Calvin
More information about the Comp.std.c
mailing list