== Why is this an issue?

The C linkage declaration ``++extern "C"++`` can not be combined with a namespace. In practical terms only one function with that name can be declared as ``++extern "C"++`` because the ``++namespace++`` is functionally ignored.


=== Noncompliant code example

[source,cpp]
----
namespace ns1 {
    extern "C" void doSomething();  // Noncompliant
    // ...
}

extern "C" {
  namespace ns2 {  // Noncompliant
    // ...
  }
  // ...
}

ns1::doSomething();
doSomething(); // Works too, same as above
----


=== Compliant solution

[source,cpp]
----
extern "C" void doSomething();

namespace ns1 {
  // ...
}

extern "C" {
  // ...
}

namespace ns2 {  // Noncompliant
  // ...
}

doSomething();
----


=== Exceptions

``++extern "C"++`` can prefix ``++typedef++``.

[source,cpp]
----
namespace ns1 {
    extern "C" typedef void c_function();  // Compliant, type named 'c_function' exists only in 'ns1' and not in the global namespace
    // ...
}
----


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

'''
== Implementation Specification
(visible only on this page)

=== Message

* Move this 'extern "C"' declaration out of the namespace.
* Move this "namespace" out of the 'extern "C"' declaration.


=== Highlighting

inner declaration (see code samples)


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