If I have a static local variable within a static global function (not class static, global static)…
foo.cpp:
static void f()
{
static T x;
...
}
Is the x instance guaranteed to be singleton across the application?
What if two translation units defined static void f() as above. Would they each have their own x instance, or would they share? Why?
staticfunctions have internal linkage, so eachfin each translation unit would be a different independent function, and there would be an instance ofxper translation unit.