Udostępnij za pośrednictwem


Ambiguous Expressions

Certain expressions are ambiguous in their meaning. These expressions occur most frequently when an object's value is modified more than once in the same expression. These expressions rely on a particular order of evaluation where the language does not define one. Consider the following example:

int i = 7;

func( i, ++i );

The C++ language does not guarantee the order in which arguments to a function call are evaluated. Therefore, in the preceding example, func could receive the values 7 and 8, or 8 and 8 for its parameters, depending on whether the parameters are evaluated from left to right or from right to left.

See Also

Reference

Semantics of Expressions