Why is it so that the function name f4 has an internal connection, and not a reference to the C-language?

The fifth example in [dcl.link] / 4 states the following:

extern "C" { static void f4(); // the name of the function f4 has internal linkage (not C language linkage) // and the function's type has C language linkage. } 

Why is this? Why is it that the function name f4 has an internal link, and not a reference to C?

PS: I ask this from the point of view of a language attorney. That is, how can the statement expressed above be derived from the normative paragraphs in the standard?

+5
source share
1 answer

From the same section, my hit:

In the communication specification, the specified language binding applies to function types of all function declarators, function names with external binding , [...]

But, f4 declared static , which means that the name has an internal link behind [basic.link] / 3 :

A name that has a namespace scope has an internal relationship if this name:

  • a template for a variable, function, or function that is explicitly declared static ; or, [...]

Therefore, C-bond is not applicable.

+5
source

Source: https://habr.com/ru/post/1270292/


All Articles