21-02-2012, 03:15 PM
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?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.
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.
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