...
If i
was equal to 0 before the statement, this statement may result in the following outcome:
Code Block | ||
---|---|---|
| ||
a = 0 + b[1]; |
Or it may legally result in the following outcome:
Code Block | ||
---|---|---|
| ||
a = 1 + b[1]; |
As a result, programs cannot safely rely on the order of evaluation of operands between sequence points.
...
Or alternatively:
Code Block | ||
---|---|---|
| ||
a = i + b[i+1]; ++i; |
Non-Compliant Code Example
...
This solution is appropriate when the programmer intends for the second argument to be one greater than the first.
Code Block | ||
---|---|---|
| ||
j = i; j++; func(i, j); |
Risk Assessment
...