Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!lsr From: lsr@Apple.COM (Larry Rosenstein) Newsgroups: comp.sys.mac.programmer Subject: Re: problem with global object construction Message-ID: <13176@goofy.Apple.COM> Date: 25 Apr 91 17:43:13 GMT References: <1991Apr23.223800.21774@searchtech.com> Organization: Apple Computer, Inc. Lines: 23 In article <1991Apr23.223800.21774@searchtech.com> davidr@searchtech.com (David Resnick) writes: >I'm using MPW 3.1, programming in C++. I seem to have discovered that >if I define a global object, the constructor for that object is Actually, the problem is that the code that performs the static object initializations gets stripped by the linker if there's no reference to any of the global objects. If you were to add a second object and refer to it, then the constructors for both objects would be called. Your inline code didn't refer to the object, which is why using the inline implementation didn't work. If you had referred to the object in some way, then it would have (I think). This does seem like a bug to me. -- Larry Rosenstein, Apple Computer, Inc. lsr@apple.com (or AppleLink: Rosenstein1)