MISRA Discussion Forums

Full Version: Rule 13.2
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
typedef unsigned char bool;
bool sensor_status;

if(sensor_status) /*Rule 13.2*/
{
....
}
Is this a violation of rule 13.2 or could it be considered as effectively boolean ( Boolean by enforcement ).
Whether type "bool" is "Boolean by enforcement" will depend on the requirements on your project. Assuming that it is decided that "bool" is to be treated as a boolean, you may then need to configure your tool to recognise the type as "effectively boolean" when the MISRA-C:2004 rules are checked.

Rule 13.2 is not violated if the type is treated as "effectively boolean".