Finding C++ static initialization order problems

后端 未结 12 809
情话喂你
情话喂你 2020-11-22 10:10

We\'ve run into some problems with the static initialization order fiasco, and I\'m looking for ways to comb through a whole lot of code to find possible occurrences. Any s

12条回答
  •  囚心锁ツ
    2020-11-22 10:34

    If your project is in Visual Studio (I've tried this with VC++ Express 2005, and with Visual Studio 2008 Pro):

    1. Open Class View (Main menu->View->Class View)
    2. Expand each project in your solution and Click on "Global Functions and Variables"

    This should give you a decent list of all of the globals that are subject to the fiasco.

    In the end, a better approach is to try to remove these objects from your project (easier said than done, sometimes).

提交回复
热议问题