Indirect comma assigned from side effects
Tomas Rokicki
rokicki at navajo.STANFORD.EDU
Sat Aug 23 04:14:12 AEST 1986
In article <3047 at umcp-cs.UUCP>, chris at umcp-cs.UUCP (Chris Torek) writes:
> In article <792 at 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
More information about the Comp.lang.c
mailing list