sizeof in #if?

T. William Wells bill at proxftl.UUCP
Tue Jul 26 23:14:35 AEST 1988


In article <12674 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
: 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.)

The committee has made it clear that the preprocessor should be
able to be written independently of the execution environment.
This is the rationale behind a number of disquieting things
(e.g., character constants not having to be the same to the
preprocessor and in the execution environment).  From that
standpoint, the preprocessor could not be aware of sizeof as that
would be dependent on the execution environment.



More information about the Comp.std.c mailing list