Macro names imbedded in pp-numbers [repost]

Walter Murray walter at hpclwjm.HP.COM
Sat Nov 18 04:38:22 AEST 1989


Norman Diamond writes:

> Both the standard and the rationale say that in the pp-number
>   0x7e-getchar()
> it is illegal for my preprocessor to expand the getchar() macro.
> If there is a real getchar() function, it is guaranteed that the
> real function must be invoked by this expression.

Isn't this overlooking the constraint in 3.1?  As I read it,
<0x7e-getchar> is a pp-number.  In translation phase 7, the
translator attempts to convert each preprocessing token into
a token.  At that point, each preprocessing token must have
the form of a keyword, an identifier, a constant, a string
literal, an operator, or a punctuator.  Because <0x7e-getchar>
doesn't match any of these, the constraint is violated, the program
is illegal, and a diagnostic must be produced.

Walter Murray
---



More information about the Comp.std.c mailing list