In GCC, local static variable is thread-safe (by special function__cxa_guard_acquire
) unless -fno-threadsafe-statics
compiler option is given.
Similarly, MSVC 2015 and onward version support the same feature and can be disabled by /Zc:threadSafeInit-
.
Is there any macro or other features, like __EXCEPTIONS
or __GXX_RTTI
to check on compilation stage if such features are enabled or not? I think checking __cplusplus
or _MSC_VER
won't help.