Versions Compared

Key

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

...

Code Block
bgColor#FFCCCC
int i;
int max;
...
if ( (i >= 0 && (i++) <= max) ) {
...  /* code */
}

It is unclear whether the value of i will be incremented as a result of evaluating the condition.

...

Code Block
bgColor#ccccff
int i;
int max;
...
if ( (i >= 0 && (i + 1) <= max) ) {
  i++;
...  /* code */
}

Risk Assessment

Attempting to modify an object that is the second operand to the logical OR or AND operator may cause that object to take on an unexpected value. This can lead to unintended program behavior.

...