Apparently, in at least C++, the evaluation order of static const members is undefined. Someone get me Bjarne Stroustrup's head, right now.
Well just fuck my entire life. I've written 500+ UI widgets for this game on the assumption that it isn't, because MSVC is pretty good at initializing them in instantiation order, lulling me into a false sense of security.
-
-
Basically, you should assume that every static member initializer works like a global variable constructor, because that's what they really are (global variables that happen to be namespaced within a class or struct). Global variables also have undefined initialization order.
-
This is different from something like Java, where whether or not a class static initializer is run depends on whether the class is fully initialized for use. C++ doesn't have that kind of tracking concept of "what globals did I run so far?" to make that topologically consistent.
- Näytä vastaukset
Uusi keskustelu -
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.