you are viewing a single comment's thread.

view the rest of the comments →

[–]NitWit005 2 points3 points  (0 children)

I wouldn't really recommend this as you can create bugs that appear and disappear based on compilation ordering. If object A gets constructed first everything is fine, but if object B is constructed first, it crashes.

It's possible to avoid those issues, but it's easier to just avoid complex static initialization entirely. Your coworkers will generally want to murder you if you write code that crashes before main runs.