MISRA Discussion Forums
Rule 5-3-1 and bool & ... - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19)
+---- Forum: 6.5 Expressions (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=134)
+---- Thread: Rule 5-3-1 and bool & ... (/showthread.php?tid=761)



Rule 5-3-1 and bool & ... - gs - 28-07-2010

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


Re: Rule 5-3-1 and bool & ... - udi - 15-05-2016

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.


Re: Rule 5-3-1 and bool & ... - misra cpp - 11-10-2016

The intention is that a “reference to bool” type is also permitted