Function Argument Evaluation

Jonathan Gingerich jon at maui.cs.ucla.edu
Fri Mar 29 04:05:31 AEST 1991


In article <3484 at inews.intel.com> bhoughto at hopi.intel.com (Blair P. Houghton) writes:
>In article <1991Mar26.181821.22912 at cs.ucla.edu> jon at maui.cs.ucla.edu (Jonathan Gingerich) writes:
>>your point perfectly well.  My question remains 'Does "the value
>>of the left operand after the assignment" mean "immediately after" or 
>>"sometime after, before the next sequence point"?'
>
>Sequence points (q.v., if you have the Standard handy) define what
>"after" is.  Machines have a tendency to have propagation delays
>for register transfers and whatnot, so it's not possible for
>"immediately" to exist; plus, this is a high-level language, and
>it will be translated into any number of object-level representations.

Un-huh.  But I don't care how the machine arrives at the result, only
what the result should be.  I don't see the language of the Standard
suggesting you do the store, then when you want the value of the
assignment expression you go look what is stored at the location.
Instead you determine what value should be stored and that is the value
of the assignment expression regardless of what happens to the
location.

>
>"Before" an operation is a sequence point.  "After" an
>operation is the next sequence point.  There is no
>"after the operation but before the sequence point."

I am no expert nor do I have the Standard handy, but I am under the
strong impression that sequence points determine what subexpressions
can be (conceptually) evaluated in random order and what must be
evaluated in sequential order.

>>A second question is whether the expression (print statement) is defined to
>>begin with, which would render the above question meaningless, unless it
>>can be reconstructed with a volitile variable.  I had thought Doug was
>>claiming the statement was not undefined, but I may have misinterpreted
>>his posting.
>
>You win the Convoluted Paragraph Of The Quarter Prize.
>I had to solve it to figure out what you could possibly
>be saying without also being totally bats:

>If you mean "is the function call guaranteed to occur
>regardless of the order of evaluation of the arguments,"
> ...

Obviously my statement is confusing as you do not understand it.
Perhaps it might be useful to you to go back and read the entire
thread.  Your last posting also missed the point and I don't want you
wasting your time.

The concensus is that the original statement had undefined behavior.
x = 100; y=200;
printf("%d %d", *(p=&x), *(p=&y))
Doug asserts that it could print out '200' '100' by order of evaluation
alone.  I find the wording about the value of an assignment expression
ambiguous enough to be unconvinced, but the point appears moot.

Jon.



More information about the Comp.std.c mailing list