Another sizeof question

diamond@tkovoa diamond at tkou02.enet.dec.com
Fri Nov 2 14:43:00 AEST 1990


In article <MEISSNER.90Oct30121525 at osf.osf.org> meissner at osf.org (Michael Meissner) writes:

>When I worked at Data General on the MV C compiler, I added sizeof
>support to the preprocessor (which is called as a coroutine from
>within the lexer).  Because the preprocessor was built into the
>compiler, it involved no hand wringing.  In fact, it would have been
>more work to disable sizeof, since the same parser was used to parse
>#if/#elif expressions as the normal expressions.

"WOULD HAVE BEEN more work"?  Do you mean that this work was not done?
As I understand the standard, a conforming processor is not allowed to
support this extension, even with a warning, even with a #pragma, etc.
A conforming processor is REQUIRED to substitute 0 for the identifier
sizeof (in an #if expression) if sizeof doesn't have a #defined value.

(#define sizeof __what_we_really_want_from_sizeof, maybe.  But you still
can't parse an un#defined sizeof that way.)
-- 
Norman Diamond, Nihon DEC    diamond at tkov50.enet.dec.com
                                    (tkou02 is scheduled for demolition)
We steer like a sports car:  I use opinions; the company uses the rack.



More information about the Comp.std.c mailing list