As @Kerrek SB noted in the comments, the answer to this question depends on the reasons that might cause your class to throw. If you are trying to acquire a system resource that may not be available, I feel that you should not declare a global object. Your program will work as soon as the user tries to start it; Needless to say, this does not look very good. If it can throw std::bad_alloc or some kind of exception that is unlikely under normal circumstances (provided that you are not trying to allocate several GB of memory), you can create a global instance; however, I didn’t do it anyway.
Instead, you can declare a global pointer to an object, create an instance of the object at the beginning of main (before threads are created, etc.) and point to that instance, then access it through a pointer. This gives your program the opportunity handle exceptions and, perhaps, offers the user to take some measures to correct the situation (for example, pull out the redo button to try to restore the resource, for example).
Praetorian
source share