Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!lll-lcc!vecpyr!amd!amdcad!decwrl!glacier!navajo!rokicki From: rokicki@navajo.STANFORD.EDU (Tomas Rokicki) Newsgroups: net.lang.c Subject: Re: Indirect comma assigned from side effects Message-ID: <796@navajo.STANFORD.EDU> Date: Fri, 22-Aug-86 14:14:12 EDT Article-I.D.: navajo.796 Posted: Fri Aug 22 14:14:12 1986 Date-Received: Sun, 24-Aug-86 05:03:16 EDT References: <792@navajo.STANFORD.EDU> <3047@umcp-cs.UUCP> Organization: Stanford University Lines: 24 In article <3047@umcp-cs.UUCP>, chris@umcp-cs.UUCP (Chris Torek) writes: > In article <792@navajo.STANFORD.EDU> I write: > > > > int lhs, rhs, index; int *pointers[9]; > > foo() { *( index=lhs, pointers[index] ) = sideeffects(); } > > > >The question is, does C allow for the possibility that the order > >of evaluation might be "index=lhs" then "sideeffects()" then > >"*pointers[index]="? > > No. The compiler can, however, effectively generate either of the > following: > Can someone second this, or show me the appropriate reference? It's Microsoft 4.0 that's putting the sideeffects() call between the two parts of the comma expression, and sideeffects() modifies index . . . you get the idea. I could find nothing in K&R, but I'm only been hacking C for a year or so. I just tested under 4.3bsd; cc also puts the sideeffects() in the middle. Comments, anyone? Thanks! -tom