Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If i was equal to 0 before the statement, this statement may result in the following outcome:

Code Block
bgColor#FFcccc
a = 0 + b[1];

Or it may legally result in the following outcome:

Code Block
bgColor#FFcccc
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
bgColor#ccccff
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
bgColor#ccccff
j = i;
j++;
func(i, j);

Risk Assessment

...