Understood about the terminology, but your translation is a bit off.
True external linkage would lead to the same identifier declared in
every TU using FString.h, which would normally be a linker error. I
know C++ has a different method of handling this to allow:
const int three = 3
To be placed in a header file in lieu of:
#define three 3
Internal linkage, I believe, would result in one "blank" per TU
using FString.h.
What I'm unclear about is if external linkage would be translated
into one single copy of "blank". Note that I don't care how many
"blank"s there are (within reason), I'm just curious as to how the
language handles this situation.
>I think this is covered by:
>
>14/4: A template name has linkage (3.5). A non-member function template
>can have internal linkage; any other template name shall have external
>linkage.
>
>3.4.6/5: a [...] static data member [...] has external linkage if the
>name of the class has external linkage.
"blank" would have external linkage. So the linker handles the
situation of multiple "blank"s with external linkage.
>If it were not constant, then I think this means the compiler+linker have
>to guarantee there is exactly one 'blank' for each different instantiated
>type CH, but with const I guess the rules are a bit relaxed. In
>particular, the compiler can choose to optimize it fully away so there is
>no space taken in any data segment, or to collide them all together so
>there is only a single 'blank' for all instantiations and all TU-s.
But shouldn't static have an effect here? The compiler should NOT
be able to optimize it fully away because it is declared static inside
a template class declaration, indicating a desire for one instance,
not internal linkage. I would think this would be a clear indication
that the programmer wants an instance of the variable and is not just
using it as an immediate value. I say "should" because I don't know
this for a fact, it just seems logical.
And even if I am wrong about the above, the template class uses a
pointer to "blank" (&blank) which, if I recall correctly, prevents the
compiler from optimizing it away.
I have an answer as it pertains to my compiler. I set a breakpoint
where "blank" is used in a program with many TUs using FString.
Regardless of the calling point, "blank" always was at the same
address.