Versions Compared

Key

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

...

Code Block
bgColor#FFCCCC
langc
unsigned int ui;
unsigned int ui2;
unsigned int sum;

if (~ui < ui2) {
  /* Handle error condition */
}
sum = ui + ui2;

This code assumes that the implementation uses two's complement representation. This assumption is commonly true but is not guaranteed by the standard.This code sample also violates INT14-C. Avoid performing bitwise and arithmetic operations on the same data.

...