Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 12.6 and functions taking/returning Boolean values.
#4
zaffanella Wrote:If Rule 12.6 does not apply to return statements (and object inizializations), then which rule is violated by the code in the second example above?
As far as we can tell, the overall guideline is that effectively Boolean types/expressions should not be confused with the proper arithmetic types/expressions, i.e., they need to be clearly separated as is the case for "plain char" types/expressions. However, we seem to be missing a specific rule corresponding to Rule 6.1.
There is no rule for effectively Boolean types corresponding to Rule 6.1 although it would clearly be sensible to write code as if such a rule did exist.

The subject of types and expressions will be given much more thorough treatment in the next version of the MISRA C Guidelines. This version, commonly referred to as MISRA C3 is currently undergoing public review in readiness for release later this year.
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)