Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uwm.edu!bionet!agate!dog.ee.lbl.gov!elf.ee.lbl.gov!torek From: torek@elf.ee.lbl.gov (Chris Torek) Newsgroups: comp.lang.c Subject: Re: What's an LValue [was A quick question] Message-ID: <11016@dog.ee.lbl.gov> Date: 16 Mar 91 07:28:24 GMT References: <1991Mar12.030759.26698@nntp-server.caltech.edu> <31306@shamash.cdc.com> <1991Mar13.050555.26149@tandem.com> <10898@dog.ee.lbl.gov> <2647@travis.csd.harris.com> Reply-To: torek@elf.ee.lbl.gov (Chris Torek) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 35 X-Local-Date: Fri, 15 Mar 91 23:28:24 PST In article <2647@travis.csd.harris.com> sean@hcx2.ssd.csd.harris.com (Sean Burke) writes: >So where would: > > struct { int array[10] ; } func() ; > > func().array[k] > >fit into these rules? > >I guess you could argue that its covered becuase > > func().array > >is implicitly taking the address of something that is not an lvalue, >and thats an error in itself. This is correct. X3.159-1989%, p. 40: A postfix expression followed by a dot . and an identifier designates a member of a structure or union object. ... is an lvalue if the first expression is an lvalue. Thus, `func().array' denotes something that is not an lvalue but would (if it existed) be a value of type `array N of ...'. Since no such type exists, it is clear that no expression of the form func().array exists. :-) Seriously: the value from func() is an `rvalue' structure and an attempt to name its `array' member is illegal. GCC permits it as an extension. ----- % Actually, I am still using a 1988 draft. -- In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427) Berkeley, CA Domain: torek@ee.lbl.gov