Boost logo

Boost :

Subject: Re: [boost] expected/result/etc
From: Peter Dimov (lists_at_[hidden])
Date: 2016-02-11 19:50:48


Gavin Lambert wrote:
> On 12/02/2016 13:02, Peter Dimov wrote:
> > That's not true. The class author decided that calling operator* on a
> > NULL pointer is a logic error and therefore a correct program should
> > never do so. This doesn't have anything to do with performance; it's a
> > question of design.
>
> Then why doesn't it throw a logic_error?

Because throwing a logic_error is an oxymoron. Logic errors should not
throw.

> Or call abort()?

That's basically what it does. Or a crash when asserts are disabled.

> Again, an assert is a useful tool in debug mode but it disappears in
> release mode. The only reason to elide this check is for performance.

That's correct.


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