Synopsis: | To clarify the actual test performed in a selection statement, there should be an explicit comparison operator unless the compared object is of effectively 'Boolean' type. |
Language: | C |
Severity Level: | 4 |
Category: | STATEMENTS |
Description: |
This means avoiding implicit comparison of char data against '\0', integral data against 0 and pointer data against the null pointer. Example:int a; ... if ( a ) /* WRONG - compare should be explicit */ should be Example:int a; ... if ( a > 0 ) /* RIGHT */ |