Reputation: 13708
There are at least 2 operators with similar texts in their description:
With respect to an indeterminately-sequenced function call, the operation of an < operator > is a single evaluation.
Where < operator > might be either "compound assignment" ([expr.ass]) or "postfix ++" ([expr.post.incr]). That rule, if understand correctly, states essentially that the any interleaving (overlapping) between the indeterminately-sequenced function call and one of the aforementioned operator is forbidden. But the Standard already forbids it in [intro.execution]p15:
<...> Evaluations A and B are indeterminately sequenced when either A is sequenced before B or B is sequenced before A, but it is unspecified which. [ Note: Indeterminately sequenced evaluations cannot overlap, but either could be executed first. — end note ] <...>
So to the question: is the wording in the operator description redundant and might as well be removed completely? And if it is not redundant please describe a situation when the text from the operators apply but the general rule does not.
Upvotes: 1
Views: 145
Reputation: 119457
The execution of the postfix increment occurs in two steps: first, an lvalue-to-rvalue conversion is applied, then, at some point before the end of the full-expression, the value stored in the object is incremented. The latter step is sequenced after the former.
Let's say A is sequenced before B, and both A and B are indeterminately sequenced with C. In that case, no pair of A, B, and C may overlap, however, there are three possible execution orders: ABC, ACB, and CAB.
In the case of the postfix increment, the additional guarantee provided by the language is that the order can only be ABC or CAB. A function call will never occur between the lvalue-to-rvalue conversion and the side effect.
Upvotes: 0