Chapter 11. Statics
Static objects are distinguished from stack variables and heap variables in that their storage is fixed and allocated by the linker, and their lifetimes are (largely) independent from the execution flow of the process. Static objects fall into three categories.
Function-local static variables are those that are defined within function scope.
Global and namespace-global static variables—also known as nonlocal statics—are those that are defined in the global namespace or within a named or anonymous namespace.
Static member variables are those that are shared between instances of the class within which they're defined.
This chapter looks at the problems inherent in the use of static objects and suggests some measures to ameliorate ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access