Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 13.2
#1
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 ).
<t></t>
Reply
#2
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".
Posted by and on behalf of the MISRA C Working Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)