$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] Looking for thoughts on a new smart pointer: shared_ptr_nonnull
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2013-10-04 13:43:29
On 4 Oct 2013 at 9:45, Eric Niebler wrote:
> This is the crux of it. If this condition really does represent a
> programmer error (and IMO in this case it does), then Matt is right.
> Throwing is wrong. Programmer error == bug == your program is already in
> some weird state. Continuing by throwing an exception and executing an
> arbitrary amount of code is not good.
>
> Precondition violations ==> assertions. Use BOOST_ASSERT. That gives
> people a way to hook the behavior while giving a sane default.
Agreed. Fatal, insta-kill exceptions are underused in C++. I tend to
sprinkle checks for "impossible" state all over my code with
insta-kill fatal exception termination if they occur. They're very
handy for detecting race conditions/memory corruption/bugs in mine or
third party code.
Niall
-- Currently unemployed and looking for work. Work Portfolio: http://careers.stackoverflow.com/nialldouglas/