order of evaluation of operands

In C++, for user-defined types a + b is a function call, and the standard says:

§5.2.2.8 – […] The order of evaluation of function arguments is unspecified. […]

For normal operators, the standard says:

§5.4 – Except where noted, the order of evaluation of operands of individual operators and subexpressions of individual expressions, and the order in which side effects take place, is unspecified. […]

These haven’t been changed for C++11. However, the wording changes in the second one to say that the order is “unsequenced” rather than unspecified, but it is essentially the same.

I don’t have a copy of the C standard, but I imagine that it is the same there as well.

Leave a Comment