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

Rule:  CFL#017Checked automatically with code checker

Synopsis:Do not make explicit comparisons to true or false
Severity Level:9
Category:Control Flow


It is usually bad style to compare a bool-type expression to true or false.

It is even dangerous to compare a non-bool-type expression to true: that might unexpectedly evaluate to false.


while (condition == false)	// wrong; bad style
while (condition == true)	// wrong; possibly dangerous
while (boolean_condition)	// okay if not an assignment, see CFL#011.