From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2006-10-06 10:32:21
Roland Schwarz <roland.schwarz_at_[hidden]> writes:
> Anthony Williams wrote:
>> I don't like the atexit call for registering the destructors,
> Why? You can't rely on the presence of any globally contructed
> objects during atexit. So why should once_class object be different?
> Also the MSVC compiler is doing just that for local static objects
> dtors: scheduling a call to atexit.
The MSVC compiler will schedule a call for each static object, so they are
destroyed in the correct reverse order, and correctly interleaved with other
calls to atexit, as per 3.6.3p3 of the C++ Standard.
Having a single call that destroys all the objects means they are not
interleaved as one might expect. One could have a call for each object that
just destroyed the last object constructed, and destroyed the list once it was
empty; that would be better.
-- Anthony Williams Software Developer Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk