śr., 3 kwi 2019 o 23:54 Peter Dimov via Boost
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;