No. It allows a compiler designer to create a compiler that implements
what he decides for the target architecture to produce "faster code."
But that doesn't mean it's producing actual real faster code because
it's all built upon the whims of its own standards, so you are no longer
comparing apples to apples. If you want to see which one generates
faster code, then parse it the same way and apply the logic the same way.
But the only thing that matters as far as the C standard is concerned is
the connection between the inputs and the outputs of the program.
Radically different ways of arranging the internal processing, that
produce the same final result, are allowed by the C language precisely
because they don't matter.
If your interest in apples and oranges were solely due to their calorie
content, without regard to their other nutrients or their flavor, then
it is entirely right and proper to compare apples and oranges - in terms
of their calorie content. Similarly, comparing two different
implementations of C for their speed and memory usage when implementing
the same code is entirely appropriate (if they're targeting the same
platform), even if the detailed machine code they generate does the same
thing in radically different ways.
Of course, if the sub-expressions have side-effects, the order in which
they are evaluated CAN make a big difference. In that case, if you want
to get those side-effects to occur in a specific order, all you have to
do is re-write your C code in such a way as to explicitly specify the
order. That has the considerable benefit of making the code easier read
and understand.
....
language, or else the language is rendered useless. And if the language
does not have specification on something as fundamental as order of
processing across an equal assignment, then it needs to be addressed.
C has been in existence for more than three decades, without that issue
being addressed, as a result of a deliberate decision that it was
unnecessary to address it. Experienced programmers know how to
explicitly specify the order, when it matters, and implementors know how
to design compilers to take advantage of the fact that the order isn't
specified, when it doesn't matter. This strongly suggests to me that the
"need to address" this issue exists mainly in your head.
I believe Java got it wrong in this case (if Java really does left to
right, I've never observed Java code being different from C code, but
maybe it's just the coding I've done).
Since C leaves it unspecified, it's not necessarily different from Java.
Therefore, a failure to observe a difference from Java may have just
been the result of bad luck. You shouldn't write C code where the order
matters - perhaps you've been accidentally paying more attention to that
rule than you thought?