Boost logo

Boost :

Subject: Re: [boost] [variant2] never-empty guarantee, again
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2019-04-04 10:35:04


śr., 3 kwi 2019 o 23:54 Peter Dimov via Boost <boost_at_[hidden]>
napisał(a):

> Andrzej Krzemienski wrote:
>
> > This is analogous to a (potentially smart) pointer: normally you can
> call
> > `*p`, but sometimes (on nullptr) it is UB, so you may need to check what
> > state it is in.
>
> If it were analogous you wouldn't be making all these arguments about
> destructors and stack unwinding. Null pointers aren't only null during
> stack
> unwinding or in destructors, they can be null anywhere. So you don't need
> to
> partition your functions into "dereferences pointers" and "does not
> dereference pointers". All functions need to check the pointer for being
> null before dereferencing it, regardless of whether they are part of
> normal
> code, or stack unwinding code.
>

Yes, I see what you mean here.What I propose is a weak invariant that gives
the impression of being stronger.

Regards,
&rzej;


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