|

 
|
| | Name : | Scott Hunsaker | Organization : | Hart Intercivic | Post Date : | 9/30/2005 |
| Section : | .20.5 | Page no. : | 5-10 | Line no.: | | Comment : | 132 II 5 p 5-10 5.4.2.t
Specifies explicit comparisons
in all if() and while() conditions.
Specifies explicit comparisons
in all if() and while() conditions
where the data type of the
conditional expression is not
Boolean or its equivalent. If the
data type is not of type
Boolean, then an explicit
comparison shall be used. For
example, a pointer shall be
compared to NULL or 0 if ( ptr
= = NULL) … or if ( ptr = = 0)
…" and for example int data
types shall follow the same
requirements."
Explicitly providing a
comparison operator to a
Boolean data type causes a
warning to be generated by
modern compilers and source
code analysis tools. The
standard should not mandate
coding practices that cause
compiler warnings to be
generated. [Borland C++
Builder V. 6] [PC-Lint V. 7.5] | |
|
|