MISRA Discussion Forums
Rule 7-3-6 Clarification - 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.7 Declarations (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=136)
+---- Thread: Rule 7-3-6 Clarification (/showthread.php?tid=1031)



Rule 7-3-6 Clarification - melinda.bradury - 27-02-2014

Does this rule prevent "using namespace ..." in a header file, if, it is inside a namespace?

e.g. is it ok to do this in the header...
namespace ComponentX
{
using namespace BasicTypes;
class AClass
{
public:
bool_t IsActive(void);
};
}
}

or would i have to do this...
BasicTypes::bool_t IsActive(void);


Re: Rule 7-3-6 Clarification - misra cpp - 05-10-2015

This use is not safe as a user of "ComponentX" can also access symbols from "BasicType".

Rule 7-3-6 correctly prohibits such use.