- Non-const global variables have external linkage by default
- Const global variables have internal linkage by default
- Functions have external linkage by default
- What’s the “static initialization order ‘fiasco’ (problem)”?
- C++ scoped static initialization is not thread-safe, on purpose! (pre-C++11)
- static vs std::call_once vs double checked locking
- Double-Checked Locking Pattern
staticvariables don’t have external linkage.
Variables with static storage duration are zero initialised. Note that x has static storage duration even though the static keyword is not used. According to the standard: “All objects which do not have dynamic storage duration, do not have thread storage duration, and are not local have static storage duration”.
static_cast (or C-style casts) can be used to cast an
int to an
reinterpret_cast (or C-style casts) can be used to cast an
to a pointer or a pointer to an