sizeof in #if?

Chris Torek chris at mimsy.UUCP
Tue Jul 26 11:25:04 AEST 1988


>henry at utzoo.uucp (Henry Spencer) writes:
>|You have an out-of-date draft, I believe.  The second-public-comment draft
>|(I haven't seen the third yet) explicitly forbids sizeof in this context.

In article <11637 at steinmetz.ge.com> davidsen at steinmetz.ge.com
(William E. Davidsen Jr) answers:
>  I believe what I have is current. I got it a week ago and it's marked
>as THIRD public review. The many references were all based on that draft.

That should be the May 13, 1988 draft.  See footnote 74 on page 84.
While the explicit wording against sizeof is gone (yet the explicit
prohibition of casts remains), the footnote remarks that the expression
is evaluated in translation phase 4, where keywords do not yet exist.
Hence the token `sizeof' is either defined (via #define) as some other
token, or is simply an identifier token: it cannot be used to find the
size of an object.  (Likewise, all types do not yet exist as keywords,
hence casts are implicitly impossible, although this is less obvious.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.std.c mailing list