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

SR:  9.4.1#6Checked automatically with code checker

Synopsis:An if statement must not lead to a degenerate comparison, for example the comparison of an unsigned quantity against a negative-valued constant.
Severity Level:4


Some conditions will always be true or false dependent on the type that has been used. For instance, a signed char is never larger than 128 or an unsigned integer can never be negative (see the example below).


unsigned int z = 0;
if (z < 0) /* 'z' can never be < 0 */

Any statements dependent on this test will never be executed.