Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!ginosko!aplcen!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: sizeof a struc field Message-ID: <20369@mimsy.umd.edu> Date: 24 Oct 89 18:35:41 GMT References: <7710@microsoft.UUCP> <11316@smoke.BRL.MIL> <7685@cdis-1.uucp> <1423@crdos1.crd.ge.COM> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 20 >In article <2488@munnari.oz.au> ok@cs.mu.oz.au (Richard O'Keefe) writes: >>... isn't the actual restriction that the argument of "sizeof" must be >>an L-value in ANSI C? ... ((struct foo*)NULL)->field is not an L-value. In article <1423@crdos1.crd.ge.COM> davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) writes: >The standard says that you may take the sizeof an array, so the >expression most definitely does not have to be an lvalue. You can also >take sizeof something const. According to the standard, arrays and consts are `non modifiable lvalue's (which rather contradicts the original meaning of l-value!). Anyway, I happen to think that `sizeof(*(type *)junk)' and similar constructs ought to be acceptable for any parse-able, cast-able `junk'. The standard happens to disagree. This is Just One Of Those Things. -- `They were supposed to be green.' In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris