Subject: Re: [boost] [variant2] never-empty guarantee, again
From: Peter Dimov (pdimov_at_[hidden])
Date: 2019-04-03 21:54:17
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk