Rule 5-3-1 and bool & ...

Moderators: david ward, misra cpp

Post Reply
Posts: 87
Joined: Thu Nov 18, 2004 1:39 am

Rule 5-3-1 and bool & ...

Post by gs » Wed Jul 28, 2010 7:03 pm

Are references to bools permitted under requirement #5-3-1?

Posts: 9
Joined: Wed May 11, 2016 8:24 am
Company: Elbit

Re: Rule 5-3-1 and bool & ...

Post by udi » Sun May 15, 2016 7:01 am

I think that references to bools are permitted under this requirement.
Maybe the treatment of references should be clarified in section 6.5.0 (Expressions / General).

- I think that this should be clear from reading the Rationale section.
- Essentially, reference is not really a type, but an alias. If this is not permitted, then I don't see how one can use references under MISRA (at least not for basic types: bool / int / double etc.).
- This is the same way that (*pBoolVar) is considered bool.
- Also the RTTI's typeid() for references, returns bool.

Since I am having an argument with the vendor of the static-analysis tool, I would appriciate if someone could clarify this.

misra cpp
Posts: 163
Joined: Mon Jun 02, 2008 1:55 pm
Company: MISRA

Re: Rule 5-3-1 and bool & ...

Post by misra cpp » Tue Oct 11, 2016 10:49 am

The intention is that a “reference to bool” type is also permitted
Posted by and on behalf of
the MISRA C++ Working Group

Post Reply

Return to “6.5 Expressions (C++)”