Subject: Re: C shared lib question
To: None <firstname.lastname@example.org>
From: Ingolf Koch <email@example.com>
Date: 03/09/2000 10:50:18
On Thu, Mar 09, 2000 at 01:55:05AM -0500, Laine Stump wrote:
> I may be misremembering, but I thought that, while the original C++
> guaranteed execution of constructors for global objects, that they later
> removed that guarantee (and that, as a matter of fact, many implementations
> of C++ don't do it).
Have a look at e.g. section 3.6.2 "Initialization of non-
local objects" in the C++ standard.
"3 It is implementation-defined whether or not the
dynamic initialization (8.5, 9.4, 12.1, 12.6.1)
of an object of namespace scope is done before
the first statement of main, it shall occur before
the first use of any function or object defined
in the same translation unit as the object to be
initialized 31) [...]
31) An object defined in namespace scope having
initialization with side-effects must be
initialized even if it is not used (3.7.1)."
So I think that execution of the constructor is guaranteed
(as long as the object is used) but it is not specified
when exactly the constructor is called.
Ingolf Koch Jena-Optronik GmbH
firstname.lastname@example.org ++49 3641 200-147
PGP: 0x7B3B5661 213C 828E 0C92 16B5 05D0 4D5B A324 EC04