Indirect comma assigned from side effects

Chris Torek chris at umcp-cs.UUCP
Tue Aug 26 23:42:37 AEST 1986


>>>	foo() { *( index=lhs, pointers[index] ) = sideeffects(); }
>>>... does C allow for the possibility that the order
>>>of evaluation might be "index=lhs" then "sideeffects()" then
>>>"*pointers[index]=<result>"?

>In article <3047 at umcp-cs.UUCP> I wrote:
>>No.

In article <2401 at ihlpg.UUCP> tainter at ihlpg.UUCP (Tainter) writes:
>As far as I can tell the only restriction on order of evaluation is 
>index=lhs before pointers[index].

After more thought, I now reverse myself.  K&R (p. 192) say only
`a pair of expressions separated by a comma is evaluated left-to-
right and the value of the left expression is discarded.'  Apparently
this does not imply that nothing else may occur in between.  I may
see whether X3J11 is more explicit, but that must wait until I am
once again near a copy of the latest draft.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris at umcp-cs		ARPA:	chris at mimsy.umd.edu



More information about the Comp.lang.c mailing list