2 ms·
Singletons can be made thread-safe (with difficulty), and you can use complex lazy singletons in C++ code while complex globals gets you into trouble with modul
by nostrademons 13y ago
Singletons can be made thread-safe (with difficulty), and you can use complex lazy singletons in C++ code while complex globals gets you into trouble with module initialization order. So there're some very pragmatic reasons to use singletons over globals, even if the same drawbacks apply to both.