...
Code Block | ||||
---|---|---|---|---|
| ||||
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.
...