Does compiler optimization cause a problem with code like this? Specifically, can the auto-increments be replied upon to evaulate in the correct order?
uint result = (array[i++] << 16) | (array[i++] << 8) | array[i++];
The spec says:
Operands in an expression are evaluated from left to right. For example, in
F(i) + G(i++) * H(i)
, methodF
is called using the old value ofi
, then methodG
is called with the old value ofi
, and, finally, methodH
is called with the new value ofi
. This is separate from and unrelated to operator precedence.