3 ms·
Uhm... but why would you have globals with constructors in a code where de/initialization order matters?
by huhtenberg 13y ago
Uhm... but why would you have globals with constructors in a code where de/initialization order matters?
- nanidin 13y agoMassive, legacy codebase, C wrappers around new C++ functionality... to be honest I don't remember the exact reason. It mostly had to do with concurrency primitives not being initialized when they needed to be due to a lack of a way to initialize a class instance the same way POD instances are initialized (aka int x = 0 in global scope.) You work with what you're given, sometimes! ;)
- pandaman 13y agoIt's not just globals with constructors and the order is not obvious. For example, few people (including yours truly) realize the whole complexity of the code like this: const float epsilon = 0.001f; const float one_sup = 1.f + epsilon; const float one_inf = 1.f - epsilon; I once spent a day trying to figure out what's going on when similar code suddenly (like after several years of constant use without any issues) broke.