C++11 offers features like thread-safe initialization of static variables, and citing that question we'll say for instance:
Logger& g_logger() {
static Logger lg;
return lg;
}
So ostensibly (?) this is true regardless of whether a module compiled with a C++11 compiler included the thread headers, or spawned any threads in its body. You're offered the guarantee even if it were linked against another module that used C++11 threads and called the function.
But what if your "other module" that calls into this code wasn't using C++11 threads, but something like Qt's QThread
. Is atomic initialization of statics then outside of the scope of C++11's ability to make such a guarantee? Or does the mere fact of a module having been compiled with C++11 and then linked against other C++11 code imply that you will get the guarantee regardless?
Does anyone know a good reference where issues like this are covered?