Xref: utzoo comp.lang.c:13687 comp.std.c:472 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!ucsd!ucsdhub!esosun!seismo!uunet!mcvax!guido From: guido@cwi.nl (Guido van Rossum) Newsgroups: comp.lang.c,comp.std.c Subject: Re: union *func() Message-ID: <7689@boring.cwi.nl> Date: 31 Oct 88 12:43:52 GMT References: <2205@arcturus> <14172@mimsy.UUCP> <1585@solo8.cs.vu.nl> <14201@mimsy.UUCP> <7686@boring.cwi.nl> Sender: news@cwi.nl Reply-To: guido@cwi.nl (Guido van Rossum) Organization: The Royal Society for Prevention of Cruelty to Amoebae Lines: 21 In article <7686@boring.cwi.nl> I wrote: >Chris's original posting said that "v = func().a" is legal, unless a is >an array. The reason was that C has no array assignment, not that >there's anything special with array members of structs returned by >functions. A less confusing way to state the rules is that "func().a" is >legal, but as an rvalue only. I received a mail message stating that in fact *any* use of func().a is illegal when a is an array member; the reason being that this use of an array name requires conversion to a pointer to its first element, and of course Chris has adequately explained why that should be illegal. I suppose that it is thus even illegal to write something like "v = func().a[0]", even though that would make perfect sense (all Chris's examples showed cases where a's address or the address of some element was actually saved). I suppose it would be possible to change various rules about pointers, arrays, rvalues and lvalues to fix this, but nobody cared. -- Guido van Rossum, Centre for Mathematics and Computer Science (CWI), Amsterdam guido@piring.cwi.nl or mcvax!piring!guido or guido%piring.cwi.nl@uunet.uu.net