Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uwm.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: sizeof a struc field Message-ID: <11120@smoke.BRL.MIL> Date: 20 Sep 89 19:39:31 GMT References: <7710@microsoft.UUCP> <11086@smoke.BRL.MIL> <131@dtoa3.dt.navy.mil> <11110@smoke.BRL.MIL> <8361@ardent.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 14 In article <8361@ardent.UUCP> jss@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.