sizeof a struc field

Jerry Schwarz Compiler jss at jra.ardent.com
Thu Sep 21 02:29:26 AEST 1989


In article <11110 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:

With regard to a discussion of:

	sizeof(((struct abc *)0)->ghi)

>
>Is the type of an illegal expression well defined?
>Perhaps it's the same as the type of one hand clapping.

Which suggests that Doug believes that this is an illegal expression.  
But is it?  It (the operand of sizeof) is an expression whose evaluation 
would result in undefined behavior, but does that make it illegal? 
I think not, and here it is used in a context where it explicitly will 
not be evaluated.

I believe the above is a legal expression.

Jerry Schwarz
jss at ardent.com



More information about the Comp.lang.c mailing list