Article View: net.lang.c
Article #9191Re: Indirect comma assigned from side effects
From: Tomas Rokicki
Date: Fri, 22 Aug 1986 18:14
Date: Fri, 22 Aug 1986 18:14
24 lines
1483 bytes
1483 bytes
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]=<result>"?
>
> 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
Technical Details
Message-ID:
<796@navajo.STANFORD.EDU>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!lll-lcc!vecpyr!amd!amdcad!decwrl!glacier!navajo!rokickiReferences:
<792@navajo.STANFORD.EDU> <3047@umcp-cs.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!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