More Re: Function Argument Evaluation argument

Blair P. Houghton bhoughto at nevin.intel.com
Tue Apr 9 18:03:31 AEST 1991


In article <1991Apr8.191009.24897 at cs.ucla.edu> jon at maui.cs.ucla.edu (Jonathan Gingerich) writes:
>In article <1991Apr6.022220.6449 at twinsun.com> eggert at twinsun.com (Paul Eggert) writes:
>>
>>While the ANSI standard does not clearly address this point, Jim Brodie
>>has reported [Journal of C Language Translation 2, 3 (Dec. 1990), 207-215]
>>that the general opinion of X3J11 seems to be that the sequence point
>>in an expression X=F(Y) prior to the call to F causes only a partial
>>ordering on the subexpressions F and Y; it does not control the
>>ordering of other subexpressions like X.  From this, I would expect

Huh?  F and Y both must be evaluated prior to that sequence point.
If this is what is meant by "partial ordering" (the common
beforeness is defined, but not the actual order of the two
wrt each other), then no problem.

>Earlier I claimed:
>
>	printf("%d %d\n", f(...v...), f(...v++...))
[...]
>would always leave x even.  In my previous example however, I believe that v
>and v++ could be evaluated before either s.p. thus it is undefined.

Again, it's confused.  There are two sequence points
among the arguments to printf(); they are the calls
to the function f().  Sequence points are defined
in terms of their proscriptions on side effects.
Since `v++' has a side effect (the assignment of
v+1 to v), it must be evaluated after the preceding
sequence point and prior to the sequence point
defined by the rightward call to f().  It is unspecified
whether the preceding sequence point comes from some
earlier statement or from the leftward call to f().
However, the first usage of `v' has no side effects.
It can be evaluated regardless of sequence points
other than the one for the leftward call to f().
The value for `v' in the leftward call is indeterminate.

				--Blair
				  "I gotta start bringing the
				   standard home with me?"



More information about the Comp.std.c mailing list