Boost logo

Boost :

From: William Kempf (sirwillard_at_[hidden])
Date: 2000-08-04 14:11:06


--- In boost_at_[hidden], Lois Goldthwaite <loisg_at_o...> wrote:
> Even when threads aren't involved, you have to be very careful
about static
> initialization. The C++ standard places no requirements on the
order in which
> static objects from different translation units will be
initialized. Better,
> IMHO, is to document that the application has to call an
initialization routine
> before using any objects or starting any threads.

Within translation units, however, the order is well defined. Many
programmers take advantage of this all of the time, even with a
simple work around to allow "global data" that's gauranteed to be
initialized at first use. With threads, things are much worse since
there can no longer ever be a gaurantee about the order of
initialization (or even the safety of initialization) of
static/global data. An initialization routine approach can help, but
not solve all of the issues involved here. An actual language change
would be required, I think.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk