MISRA.NS.GLOBAL.USINGThe global namespace shall not contain using directives and declarations. MISRA-C++ Rule 7-3-1 (required): The global namespace shall only contain main, namespace declarations and extern "C" declarations.RationaleDeclaring names into appropriate namespaces reduces the names found during lookup, helping to ensure that the names found meet developer expectations. ExceptionThe types defined for compliance with Rule 3—9—2 may also be in the global namespace. Examplenamespace std // Compliant { namespace Inner { int x; } } using namespace std; // Non-compliant using std::Inner::x; // Non-compliant namespace Outer { using Inner::x; // Compliant } int main ( ) // Compliant { return 0; } |