Another sizeof question

Henry Spencer henry at zoo.toronto.edu
Fri Nov 2 03:49:35 AEST 1990


In article <13294 at crdgw1.crd.ge.com> volpe at camelback.crd.ge.com (Christopher R Volpe) writes:
>But, could you or someone else point me to a reference in the Standard
>that says that a constant expression in a preprocessor context cannot
>contain sizeof? I'm sure it's in there but I can't find it. 

Note, in 3.1, that the definition of preprocessing-token does not include
`keyword' as a possibility.  Until pp-tokens get converted to tokens in
phase 7 (see 2.1.1.2), `sizeof' is an identifier, not a keyword.  And in
3.8.1, we see that in #if, after macro substitution and etc, "all remaining
identifiers are replaced with the pp-number 0, and then each preprocessing
token is converted into a token".  So `sizeof' can appear in #if, but it
is an ordinary identifier, not the keyword that denotes the operator
described in 3.3.3.4.  No facility of C expressions that is invoked via
a keyword can be used in #if expressions.
-- 
"I don't *want* to be normal!"         | Henry Spencer at U of Toronto Zoology
"Not to worry."                        |  henry at zoo.toronto.edu   utzoo!henry



More information about the Comp.std.c mailing list