With respect to C from the c99
draft standard 6.5.2
:
Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be read only to determine the value to be stored.
it cites the following code examples as being undefined:
i = ++i + 1;
a[i++] = i;
The section is same in the draft 2011 standard as well but it reads a bit more awkward. This is a good reference on sequence point.
Section 15.7
is the relevant section from the JLS
:
The Java programming language guarantees that the operands of operators appear to be evaluated in a specific evaluation order, namely, from left to right.
It is recommended that code not rely crucially on this specification. Code is usually clearer when each expression contains at most one side effect