I
Ike Naar
Right. But why not "unspecified" rather than "undefined behaviour"?
Isn't it easy to get unspecified program results which are not
undefined, but still useful based on knowledge of the implementation, or
still portable in that a program does not crash and is guaranteed to
translate?
aw0 and ar1 might interfere with each other in such a way that there
are no results at all (for instance, the hardware might trap when it
detects that the same location is simultaneously read from and written
to).
[snip]
Ok. Isn't it interesting how "any order" for the function calls in
example 6.5.2.2p12 means "one at a time" but we are allowed simultaneous
order for the write of '++a' and the read of 'a + 5'? Or does it?
Isn't it interesting that 6.5.2.2p10 details the unspecified order for
"the function designator, the actual arguments, and subexpressions
within the actual arguments." Why the distinction on "subexpressions"
here? Why not the distinction in 6.5p2?
Here you bring up an interesting point.
The standard says that there is a sequence point between
- the evaluation of function designator and arguments, and
= the actual execution of the function
Now in the following expression:
g(x) + h(y);
are g and h allowed to run simultaneously?
Could there be the following sequence of events:
evaluation of g, x, h, y run g and h evaluation of ``+''
---------------------------+---------------+---------------------
SP0 SP1
After all, there is a sequence point (SP0) between
- evaluation of g and x, and
= the execution of g
Likewise, there is a sequence point (again, SP0) between
- evaluation of h and y, and
= the execution of h
Is there anything in the standard that forbids this?