如果嵌套 extern "C" 会发生什么?

What happens if you nest extern "C"?

看起来嵌套 extern "C" 是合法的。例如:

extern "C" extern "C" void foo();

第二个extern "C"基本上被忽略了。这是由 C++ 标准保证的吗?在哪里?

是的,但它实际上是第一个 extern "C" 被忽略的。引用标准 [dcl.link]:

Linkage specifications nest. When linkage specifications nest, the innermost one determines the language linkage.