Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
3-9-2 and 'bool'
#1
Is rule #3-9-2 intended to apply to the 'bool' type?
Reply
#2
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.
<t></t>
Reply
#3
3-9-2 does not apply to bool as it is not a "basic numeric type".
Posted by and on behalf of
the MISRA C++ Working Group
Reply
#4
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 (https://www.misra.org.uk/forum/viewtopic...240&t=1317) you say that plain char is not a numerical type.
<t></t>
Reply
#5
"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)
Posted by and on behalf of
the MISRA C++ Working Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)