|
Boost : |
Subject: Re: [boost] New Boost.XInt Library, request preliminary review
From: Peter Dimov (pdimov_at_[hidden])
Date: 2010-03-30 08:23:53
Stewart, Robert wrote:
> How does one mix code wanting exceptions with code not wanting them?
Pretty easy (bad_alloc aside (*)), since the only way to get an exception
when doing integer operations is to divide by zero (**). So code not wanting
exceptions needs only not divide by zero - problem solved. This of course
assumes that the exceptions are not delayed via a signaling NaN with the
express purpose of making your life difficult by turning unary op+/- into a
throwing operation.
(*) And by the way, out of memory is not overflow. It's possible to run out
of memory while computing an integer that is smaller than another integer
that already has been computed. This is not what overflow means.
(**) OK, sqrt(-1) throws as well.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk