3-9-2 and 'bool'
Moderators: david ward, misra cpp
-
- Posts: 87
- Joined: Thu Nov 18, 2004 1:39 am
3-9-2 and 'bool'
Is rule #3-9-2 intended to apply to the 'bool' type?
-
- Posts: 2
- Joined: Thu Nov 20, 2014 5:58 pm
- Company: Energid
Re: 3-9-2 and 'bool'
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.
"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.
-
- Posts: 148
- Joined: Mon Jun 02, 2008 1:55 pm
- Company: MISRA
Re: 3-9-2 and 'bool'
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
the MISRA C++ Working Group
-
- Posts: 12
- Joined: Wed May 14, 2014 1:02 pm
- Company: Axivion GmbH
Re: 3-9-2 and 'bool'
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.
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.
-
- Posts: 148
- Joined: Mon Jun 02, 2008 1:55 pm
- Company: MISRA
Re: 3-9-2 and 'bool'
"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)
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
the MISRA C++ Working Group