On Tue, 29 Jan 2008 14:29:29 PST Roman Shaposhnik <[EMAIL PROTECTED]> 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.