sizeof a struc field
Doug Gwyn
gwyn at smoke.BRL.MIL
Thu Sep 21 05:39:31 AEST 1989
In article <8361 at ardent.UUCP> jss at jra.ardent.com (Jerry Schwarz (Compiler)) writes:
-With regard to a discussion of:
- sizeof(((struct abc *)0)->ghi)
-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.
(((struct abc *)0)->ghi) is not a valid unary expression,
because the left-hand operand of the -> is not an lvalue
that points at an object (see 3.3.2.3 Semantics).
This has nothing to do with evaluation.
More information about the Comp.lang.c
mailing list