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

Rule:  6.3.2.3.aChecked automatically with code checker

Synopsis:bool shall be used as boolean type.
Language:C
Severity Level:5
Category:Conversions


Description:

Justification

Different types of booleans should not be mixed (bool, Boolean, _Bool, int and embedded C-language boolean expression) because they have different definitions and therefore different behavior.

Example

#define TRUE 1
int b = TRUE; /* WRONG */
bool my_bool = true; /* RIGHT */

Justification

If a variable is passed to an X Motif library function it should be declared as being of type Boolean instead of bool. This is because the X Motif library function expect this Boolean type, which has a subtle different semantics compared to bool.