Function Argument Evaluation

Doug Gwyn gwyn at smoke.brl.mil
Mon Mar 25 18:36:18 AEST 1991


In article <1991Mar23.014442.24307 at cs.ucla.edu> jon at maui.cs.ucla.edu (Jonathan Gingerich) writes:
>I'm confused.  3 answers have been given to the question.  If I understand
>Doug's last answer, p may be either &x or &y after the statement, but I
>don't see how this affects the value of (p=&x) and (p=&y) which would 
>remain &x and &y (given the correct type of p).

There is a (possibly apocryphal) story told about Dirac.  It seems that
he gave a talk on some work he had done, and asked if there were any
questions.  A member of the audience said "Professor Dirac, I don't
understand how you derived that equation."  Dirac replied "That is not
a question."

However, guessing what your question might have been were you to have
asked one, I'll point out that the previously cited sentence from the C
standard, "The order of evaluation of the function designator, the
arguments, and subexpressions within the arguments is unspecified, but
there is a sequence point before the actual call", makes it quite clear
that a conforming implementation is allowed to interleave evaluation of
the two function argument expressions in question.  In particular, it
can perform both assignments to the variable p before applying the *
operator, and thus could obtain the same value for both expressions.



More information about the Comp.std.c mailing list