Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Boolean typedef and rules 6.4 and 10.1
#2
In both code fragments
Code:
sts_sw_info.bl_hardware_supported = FALSE;
and
Code:
if (sts_sw_info.bl_hardware_supported == FALSE)
{
// Do something...
}
the underlying types of the operands are unsigned int. The fact that the controlling expression of the if statement is expected to be Boolean does not affect anything.

It would seem that your tool is diagnosing a violation of Rule 10.1 when there isn't any problem.

Regarding Rule 6.4, it doesn't matter whether unsigned int is used or whether another type that is defined as unsigned int is used. The two are equivalent, as noted in the code for Rule 6.4 in the MISRA C exemplar suite.

If this is being reported as a Rule 6.4 violation by a tool then, again, it would appear that the tool is diagnosing a violation when there is no actual problem.
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)