...
Programs cannot safely rely on the order of evaluation of operands between sequence points. In this non-compliant code example, the order of evaluation of the operands to the {+} operator are unspecified.
...
Code Block | ||
---|---|---|
| ||
func(i++, i); |
The call to func()
has undefined behavior because there are no sequence points between the argument expressions. The first (left) argument expression reads the value of i
(to determine the value to be stored) and then modifies i
. The second (right) argument expression reads the value of i
between the same pair of sequence points as the first argument, but not to determine the value to be stored in i
. This additional attempt to read the value of i
has undefined behavior.
...