Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!brunix!sdm From: sdm@cs.brown.edu (Scott Meyers) Newsgroups: comp.lang.c++ Subject: Initialization Order of Statics/Globals Message-ID: <45330@brunix.UUCP> Date: 19 Jul 90 17:32:08 GMT Sender: news@brunix.UUCP Reply-To: sdm@cs.brown.edu (Scott Meyers) Organization: Brown University Department of Computer Science Lines: 28 What's the latest story on initialization order of statics and globals? In particular, can one rely on static data members of a class being initialized before global objects of that class? For example: class OneOnly { private: static int objectCount; public: OneOnly() { if (objectCount++ > 1) error("Too many objects"); } }; int OneOnly::objectCount = 0; OneOnly thisObject; Can I rely on OneOnly::objectCount being initialized before thisObject? I took a look at E&S, but I'm still unclear on this point. (By the way, I know that statics are pre-initialized to 0, so the question for this example is moot, but the general question remains...) Thanks, Scott