Function Argument Evaluation

Norman Diamond diamond at jit345.swstokyo.dec.com
Fri Mar 29 17:18:12 AEST 1991


In article <17985 at crdgw1.crd.ge.com> volpe at camelback.crd.ge.com (Christopher R Volpe) writes:
>In article <9439 at cognos.UUCP>, jimp at cognos.UUCP (Jim Patterson) writes:
>|>So, *(p=&x) is actually *(p) after assignment, not *(&x), and any of the
>|>four results quoted previously is possible.
>
>I believe that in any situation in which the behavior is *not* undefined,
>there is absolutely no difference between "the value of the left operand
>after assignment" and "the value of the right operand suitably cast to
>the type of the left operand".

If the left operand is volatile, the standard says that the value of the
right operand gets stored into it.  However, it is not quite clear if the
left operand is actually required to contain that value (for any finite
or infinitesimal length of time).  Suppose it's a hardware device which
automatically doubles the value stored into it?  (Pick a less trivial
example for this if you wish.)

The question has already been asked, if the left operand is volatile,
is the processor required to follow the store with a fetch, in order to
use the actually-contained value in the outer expression.  The answers
given in this newsgroup converged on "No," it was not necessary.  But I
sure don't understand why.  If the fetch isn't done, it sure seems to me
that it violates the rules about volatile.
--
Norman Diamond       diamond at tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.



More information about the Comp.std.c mailing list