Rule 7-3-6 Clarification

Moderators: david ward, misra cpp

Post Reply
Posts: 2
Joined: Wed Feb 26, 2014 3:55 pm
Company: Invensys/Schneider

Rule 7-3-6 Clarification

Post by melinda.bradury » Thu Feb 27, 2014 2:31 pm

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
bool_t IsActive(void);

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

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

Re: Rule 7-3-6 Clarification

Post by misra cpp » Mon Oct 05, 2015 2:59 pm

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

Rule 7-3-6 correctly prohibits such use.
Posted by and on behalf of
the MISRA C++ Working Group

Post Reply

Return to “6.7 Declarations (C++)”