TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
ASML C Coding Standard
Search

Rule:  6.5.8.aChecked automatically with code checker

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 */
{
 ...
}