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

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.
Language:C
Severity Level:4
Category:STATEMENTS


Description:

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).

Example:

unsigned int z = 0;
...
if (z < 0) /* īzī can never be < 0 */
{
... 
}
...

Any statements dependent on this test will never be executed.