From mboxrd@z Thu Jan 1 00:00:00 1970 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] I like this one In-reply-to: Your message of "Tue, 29 Jan 2008 14:29:29 PST." <1201645769.28153.100.camel@work.sfbay.sun.com> From: Bakul Shah Date: Tue, 29 Jan 2008 14:58:12 -0800 Message-Id: <20080129225812.C99605B52@mail.bitblocks.com> Topicbox-Message-UUID: 3cb3fb4c-ead3-11e9-9d60-3106f5b1d025 On Tue, 29 Jan 2008 14:29:29 PST Roman Shaposhnik wrote: > On Tue, 2008-01-29 at 17:11 -0500, Pietro Gagliardi wrote: > > I don't get it... But why would you control how constructors are run? To give programmers enough rope and then some to hang themselves? > You don't unless you're totally worried about your job security and > would want to make maintenance of your code code virtually > impossible. ;-) C++ at least was smart enough not to promise anything > about the sequencing of constructors for global objects. > > Now, I can bet money that the reason they did it is for shared > libraries. And that opens up a whole new can of worms right there. I was very briefly exposed to stuff like the following (to be compiled with Microsoft's C++ compiler). #if defined(_LIB) #define XXX_API #elif defined(_XXX_EXPORTS) #define XXX_API __declspec(dllexport) #else #define XXX_API __declspec(dllimport) #endif class XXX_API foo { ... } With stuff like this if you choose the wrong magic in your Visual Studio project files, _bad_ things happen! I am still having nightmares. I'd rather have a root canal treatment.