Boost logo

Boost :

Subject: Re: [boost] [safe_numerics] Review Part 2 (Implementation)
From: Robert Ramey (ramey_at_[hidden])
Date: 2017-03-07 21:03:03

On 3/7/17 11:33 AM, Andrzej Krzemienski via Boost wrote:
> safe<int> does a check for this condition, but I find it quite surprising
> that it throws a domain_error rather than overflow_error. How do you make a
> call whether it is an overflow or a domain error? For mathematical ints
> dividing -2147483648 by -1 is well defined.

Truth is I didn't take a whole lot of care in deciding which one to use.
In this case, I think your right that overflow would be a better choice.

Boost list run by bdawes at, gregod at, cpdaniel at, john at