Request for the detailed description of “Static Initialization Order Fiasco”

做~自己de王妃 提交于 2019-12-02 04:31:13

The static initialization order fiasco is fairly straightforward: static objects in a single translation unit are initialized in the order in which they are declared, but there is no guarantee as to the order in which static objects in different translation units are initialized with respect to each other.

So, in your specific example, foos in main.cpp may be initialized before foo::foofaa, which is declared in libsource.cpp.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!