Boost logo

Boost :

Subject: Re: [boost] "peer reviewed" - Rights and responsibilities of maintainers
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2018-10-17 01:10:37


AMDG

On 10/16/2018 06:54 PM, Gavin Lambert via Boost wrote:
> <snip>
> Technically it's UB to access a global bool after "destruction" (just
> like any other object) and it could possibly be "destroyed" before the
> singleton due to unspecified global destruction order.
>

That's not correct. If an object has static storage duration
and a trivial destructor, then it is never "destroyed."
Its storage exists "for the lifetime of the program" [basic.stc.static]
and its lifetime ends when "the storage which the object
occupies is reused or released" [basic.life]

> Though you're correct that since bool has a trivial destructor it is
> *usually* not actually a problem in practice.  (AFAIK a compiler is
> within its rights to zero or otherwise stomp the memory after
> "destruction", though most probably wouldn't bother, except perhaps as a
> diagnostic/sanitiser.)
>
> It's still a sign of a fundamental lifetime mismatch somewhere, though.
>
In Christ,
Steven Watanabe


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