> >>But I am thankful they didn't create a headless monster like the
> >>"C++ static object creation order" nightmare.
>
> Damn, I haven't got that message (yet?). Anyone know what he was
> talking about? Yes, I'm a C++ programmer (I've mentioned it here
> enough times), but I have no idea which particular 'headless monster'
> he's referring to :>
oops sorry. i suppose it's a bit off topic. :-)
i was talking about the weird rules in C++ about the order
static objects are constructed. If the objects depend on
each other you can have a subtle bug occur "behind the
scenes" when they get initialised in an unexpected order.
My copy of the ARM discusses this stuff in sections
3.4 and 6.7. The basic idea is that static objects
get constructed "when control passes through their
declarations" (whatever the hell that means).
This gets even worse when you look at the order destructors
for these things get called - it's specifically left open.
So - in particular - they might not get called in "reverse
order".
In a later post Paul Spain noted that Delphi can get into
these same sorts of things in "unit initialisation" code
which I had overlooked. IMO Delphi is more predictable -
in C++ I'm never really sure what will happen until i watch
the thing start up in a debugger.
Probably I misspoke when I said it was "headless" - obviously
smarter heads than mine DO seem to be able to reliably
interpret the rules. I just find it one of the more
obscure confusions in C++.
-ns
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"