The modern, more pattern-oriented way is not to use globals in the first place.
There’s no other way around it.
It wouldn’t be much of a “fiasco”, otherwise!
More Related Contents:
- What is the lifetime of a static variable in a C++ function?
- Stack, Static, and Heap in C++
- Static array vs. dynamic array in C++
- Static variables initialisation order
- C++ static initialization order
- Initialize static variables in C++ class?
- Defining static members in C++
- Static variables in C++
- When are static and global variables initialized?
- How to force a static member to be initialized?
- Are function static variables thread-safe in GCC?
- C++ where to initialize static const
- How to initialize a static const member in C++?
- C++: When (and how) are C++ Global Static Constructors Called?
- What makes a static variable initialize only once?
- constexpr static member before/after C++17
- C++ singleton vs. global static object
- Are static fields inherited?
- Circular C++ Header Includes
- When should I write the keyword ‘static’ before a non-member function?
- Accessing static class variables in C++?
- static member initialization for specialized template class
- How do static variables in lambda function objects work?
- Advantages of classes with only static methods in C++
- Adding static libcurl to Code::Blocks IDE
- Should one never use static inline function?
- Static global variables in C++
- C++ static initialization vs __attribute__((constructor))
- On local and global static variables in C++
- C++, static vs. namespace vs. singleton