No, the new standard does not specify a sequencing or ordering of evaluations of all subexpressions.
The expression a + b + c
is grouped grammatically as (a + b) + c
, but the three subexpressions a
, b
and c
can be evaluated in any order and the evaluations are not sequenced with respect to each other.
To make this more concrete, consider:
int main()
{
return printf("Hello") + printf("World") + printf("\n");
}
As for your code: There is no ambiguity there. It is one expression, an assignment expression of the form a = b
, where a
is the lvalue var1
and b
is the subexpression var2 = 30
. The fact that you're wondering whether var1
ends up as 20
or as 30
leads me to believe that you're unsure about the operator associativity (for =
). That, however, has never been ambiguous and is perfectly well specified in all language variants I can think of. The assigment operator associates on the right, leading to the subexpressions a
and b
that I have described. This (extremely fundamental) aspect of the language has not been changed in C++11.
If you really want to combine the two problems, you should consider the following expression:
var1 = 10;
(var1 = 20) = (var2 = var1);
Now the final expression is also a = b
, but both a
and b
are non-trivial subexpression whose evaluation is not ordered.