Tag: static-keyword
7 posts
-
C++ Dynamic Initialization: When Globals and Statics Run Their Initializers
What makes a C++ initializer dynamic, when it runs relative to main, ordering within and across files, exceptions before main, local statics, and constinit.
-
static, extern, const, constexpr, inline, volatile, mutable: What Each C++ Keyword Changes
A practical rundown of C++ storage and type-qualifier keywords - static, extern, const, constexpr, inline, volatile, and mutable - with what each one actually changes about linkage and lifetime.
-
static Functions in C++: Class Statics vs File-Scope Statics, Linkage and the ODR
How static functions behave in C++ - class static member functions, file-scope static functions and internal linkage, ODR implications, and their effect on memory layout and performance.
-
C++ static Members: Static Data & Static Functions
Class static members shared by all instances: declaration vs definition, ODR, thread safety, the static init/deinit order fiasco, singletons, factories, and C++17 inline static in headers.
-
C++ Linkage and Storage Duration: extern and static
External, internal and no linkage plus automatic, static, thread-local and dynamic storage in C++: extern, anonymous namespaces, static locals, init order.
-
How the C++ Linker Works: Undefined References, Library Order, and Shared Libraries
What the C++ linker actually does, why "undefined reference" and "multiple definition" happen, why -l order matters, and how rpath, $ORIGIN and LTO behave.
-
C++ Static Initialization Order
Why globals in different C++ translation units initialize in an unspecified order, and how function-local statics, constinit, inline constexpr, explicit init functions and std::optional fix it.