Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: fixed post-condition test for subtraction (again)

...

This compliant solution performs a post-condition test that the result of the unsigned subtraction operation udiff is not greater than either of the operandsminuend.

Code Block
bgColor#ccccff
unsigned int ui1, ui2, udiff ;

/* Initialize ui1 and ui2 */

udiff = ui1 - ui2;
if (udiff > ui1) {
  /* handle error condition */
}

...