Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Endian mini-review
From: Olaf van der Spek (ml_at_[hidden])
Date: 2015-01-26 16:49:30


On Mon, Jan 26, 2015 at 10:42 PM, Peter Dimov <lists_at_[hidden]> wrote:
> Beman Dawes wrote:
>>
>> Perhaps an error checking policy could be added as a template parameter,
>> with two supplied - one a nop, the other throwing an exception on overflow.
>
>
> Given that in many, if not most, cases, the check is a no-op - when the
> value type and the bits match - it might instead make sense to make the
> methods conditionally noexcept when the bits are enough to store everything
> in range, and always throw on overflow otherwise.

Isn't overflow more like a logic error than a runtime error? An assert
might make more sense.

-- 
Olaf

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