== Why is this an issue?

`using` directives add additional scopes to the set of scopes searched during name lookup. All identifiers in these scopes become visible, increasing the possibility that the identifier found by the compiler does not meet developer expectations.

_Using-declarations_ or fully-qualified names restricts the set of names considered to only the name explicitly specified, and so these are safer options.

=== Exceptions

It is not easy to fully qualify the content of the `std::literals` and `std::placeholders` namespaces. Therefore, this rule does not raise violations for `using` directives that target these namespaces or their sub-namespaces.

=== Noncompliant code example

[source,cpp]
----
namespace NS1 {
  int f();
}

using namespace NS1; // Noncompliant

void g() {
  f();
}
----

=== Compliant solution

[source,cpp]
----
namespace NS1 {
  int f();
}

void g() {
  NS1::f();
}

// Or

using NS1::f; // Compliant, this is a using declaration

void g() {
  f();
}


----


== Resources

* MISRA {cpp}:2008, 7-3-4 - using-directives shall not be used.


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

=== relates to: S1003

=== on 31 Mar 2015, 19:07:03 Evgeny Mandrikov wrote:
\[~ann.campbell.2] implementation seems more complete (SQALE, description) than this spec.

=== on 13 Apr 2015, 19:16:38 Evgeny Mandrikov wrote:
\[~ann.campbell.2] Changed spelling of "using-directives" and "using-declarations" to match {cpp} language specification. Also wondering why blocker, but not active by default? Note that in implementation currently major and active.

=== on 20 Apr 2015, 14:00:33 Ann Campbell wrote:
in fact [~evgeny.mandrikov] I don't think I had previously edited either of those two attributes

endif::env-github,rspecator-view[]
