Synopsis: | Comparison of unsigned operands shall not occur against negative values. |
Language: | C |
Severity Level: | 6 |
Category: | Expressions |
Description: |
Justification Such code is useless and probably a bug. Example /* The negative constant (NEG) will be converted to a (positive) "large" * unsigned int. The result is a comparison of uia with a positive * unsigned value. */ unsigned int uia; if (uia < NEG) /* NEG converted to unsigned (positive) int */ { ... } |