More Re: Function Argument Evaluation argument

Jonathan Gingerich jon at maui.cs.ucla.edu
Thu Apr 11 05:18:53 AEST 1991


In article <3731 at inews.intel.com> bhoughto at nevin.intel.com (Blair P. Houghton) writes:
>In article <1991Apr8.191009.24897 at cs.ucla.edu> jon at maui.cs.ucla.edu (Jonathan Gingerich) writes:
>>Earlier I claimed:
>>
>>	printf("%d %d\n", f(...v...), f(...v++...))
>[was unspecified not undefined]
>> 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.

You are correct as far as you go.  But v and v++ can both be evaluated before
either s.p. associated with the application of f()'s and because v is both
read and written in separate actions it's undefined.

Jon.



More information about the Comp.std.c mailing list