From reading the other posts on global objects/variables here and elsewhere I don't see myself getting entirely helpful answers here but I've considered the options and I think that in my case there is use for global objects.
There is one thing I don't understand the mechanics of: If an object is global, is it essentially initialized in main() and then passed around secretly by the compiler to every function that needs it or is there some sort of special place in memory that it's placed so it can be just linked in to any reference to it? Is it some other magic?
The main question, though, is just say for argument's sake that I had global variables and couldn't do anything about them. Ideally I wanted the constructors to work like they should and set up the class completely. The problem is that if they throw an exception (which they do sometimes), I can't catch them. The only alternatives I can think of are to have global pointers (maybe auto_ptrs to keep them safe) and initialise them in a function which catches relevant exceptions; or to use normal objects, bypass the constructors and call an init() function somewhere.
The thing is, if there are only a select few global objects (such as CGI, User and DBI objects in a single-user web app), surely that's more efficient and allows for cleaner code than passing objects around all over the place?
Sorry if this all seems a bit random/uninformed but I'm still pretty new to this. Any help would be appreciated.