The mean answer is:
depends
The problem is that the sequence of evaluating function arguments is undefined. I.e. one compiler might do it this way, another the other way. It might even change with the argument type or the number of argument.
To illustrate this: in C++ the operator can be written as function calls, e.g.:
int result = operator+(operator+(operator++(i), operator++(i)), operator++(i, 0));
Note that
operator++(i)
is the pre-increment operator, while
operator++(i, 0)
is the post-increment operator.
Try the two cases:
A) your compiler evaluates the arguments from left to right
B) your compiler evaluates the arguments from right to left
A) see the sequence from left to right (top-down)
result = operator+ ( operator+ ( operator++(i) , operator++(i) ) , operator++(i, 0) )
B) see the sequence numbers are shuffled so that the 2nd is evaluated first
result = operator+ ( operator+ ( operator++(i) , operator++(i) ) , operator++(i, 0) )
The prudent conclusion is: don't do this kind of expression.
If any used variable in an expression has a side effect, it should be the only instance of that variable in the whole expression, otherwise you might experience undesired effects.
Cheers
Andi
PS: If you are interested in the standard, you might for example see
open-std.org: Working Draft, Standard for Programming Language C++[
^], section 1.9: Program execution, paragraph 13 and following (especially paragraph 15 and associated examples).
"[...]Value computations and side effects associated with different argument expressions are unsequenced[...]" - where "unsequenced" roughly means that they can be evaluated in any order.