Page 1 of 1

3-9-2 and 'bool'

Posted: Tue Jun 12, 2012 3:23 pm
by gs
Is rule #3-9-2 intended to apply to the 'bool' type?

Re: 3-9-2 and 'bool'

Posted: Fri Nov 21, 2014 2:23 pm
by markturney
In section 5. Introduction to the rules, the MISRA C++ 2008 standard specifies that:

"In code fragments, in order to comply with Rule 3–9–2, the following typedef’d types have been assumed... Note that the bool and wchar_t types do not have typedefs.".

All code samples throughout the rest of the standard include the use of bool, so I think it is safe to say that 3-9-2 does not prevent the use of bool.

Re: 3-9-2 and 'bool'

Posted: Mon Oct 05, 2015 2:40 pm
by misra cpp
3-9-2 does not apply to bool as it is not a "basic numeric type".

Re: 3-9-2 and 'bool'

Posted: Tue Sep 20, 2016 1:55 pm
by grunwald
Where is the term "basic numerical type" defined?

Does 3-9-2 apply to plain char? The exception "allowing any use of (plain) char to be detected and reported by analysis tools" seems to indicate that analysis tools should report plain char as a 3-9-2 violation; but over in the Misra-C:2012 forum (viewtopic.php?f=240&t=1317) you say that plain char is not a numerical type.

Re: 3-9-2 and 'bool'

Posted: Tue Oct 11, 2016 10:17 am
by misra cpp
"basic numerical type" is defined in the first sentence of the rationale of 3-9-2

Currently, this rule does apply to (plain) char, however a future edition will align this rule with that in MISRA C:2012 (Directive 4.6)