Newsgroups: comp.std.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Another sizeof question Message-ID: <1990Nov1.164935.4398@zoo.toronto.edu> Organization: U of Toronto Zoology References: <13171@crdgw1.crd.ge.com> <1990Oct28.223702.27918@zoo.toronto.edu> <13294@crdgw1.crd.ge.com> Date: Thu, 1 Nov 90 16:49:35 GMT In article <13294@crdgw1.crd.ge.com> volpe@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@zoo.toronto.edu utzoo!henry