Macro names imbedded in pp-numbers [repost]

Prescott K Turner pkturner at cup.portal.com
Sun Nov 19 06:23:54 AEST 1989


> 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.
The draft standard says, "Each preprocessing token is converted into a
token".   Since 0x7e-getchar cannot be converted into a token, there
is an error, and the real getchar() function need not be invoked.
> I will have to add code to my scanner, and slow it down, so that
> it will not call the preprocessor if it finds a macro in the middle
> of a pp-number.
"getchar" in the middle of a pp-number should give a scanner no
more difficulty than "getchar" in the middle of an identifier, e.g.
    mygetchar
--
Prescott K. Turner, Jr.
13 Burning Tree Rd., Natick, MA 01760 USA    (508) 653-0357
UUCP: ...sun!cup.portal.com!pkturner    Internet: pkturner at cup.portal.com



More information about the Comp.std.c mailing list