> This is way off-topic wrt the original post, but ah well. > I've always been of the 'globals-are-evil' school myself, however > recently I've started reconsidering. For example, what do you suggest > as a good way to handle an object like a Preferences object, something > that you need almost everywhere? It would of course be possible to > pass around pointers from function to function but you'll have to > agree that that is even more ugly than a global object. What's more is > that it is always possible that you'll have to add a preference later > where you didn't anticipate it, so you'd have to redo all functions > that lead to that point. IMHO this is a case where a global object is > very useful. > I've also tried using a static function in the Preferences class > before, but in the end that's just a global in disguise.
On a related path, check out the following outstanding articles. Maybe they can change how you look at 'globals' in C++: http://www.gotw.ca/gotw/084.htm http://www.gotw.ca/publications/mill02.htm http://www.cuj.com/articles/2000/0002/0002c/0002c.htm Herb Sutter's "Exceptional C++", items 31-34. HTH, ------------- Ehsan Akhgari Farda Technology (www.farda-tech.com) List Owner: [EMAIL PROTECTED] [ Email: [EMAIL PROTECTED] ] [ WWW: http://www.beginthread.com/Ehsan ] If flying is safe, why is the airport called the terminal?
