Re: Should Globally Needed Objects be Members in Main Frame, Application, or be Global?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




Tom Serface wrote:
I'd say what ever works for you and gives you stable code and easy
maintenance in your work environment. I do like the g_ syntax for globals,
but I'd assume those would be statically global, not members of a class. I
will go on the record as not liking to use those unless there is no other
way around it.

I exclusively use Singletons and advocate strong use of it, especially
in large projects. More importantly, I create the object (what you call
global object) only when called on the method to access it. This is a
key difference: all other options will create the object when app comes
live. The method I use does not do that. This was discussed in one of
C++ books at length (either SMeyers or Anderescu(?)).

---
Ajay

.



Relevant Pages