Boost logo

Boost :

Subject: Re: [boost] New Boost.XInt Library, request preliminary review
From: DE (satan66613_at_[hidden])
Date: 2010-03-30 13:07:04


on 30.03.2010 at 19:45
 Peter Dimov wrote :
> Right. What is the purpose of the NaN? Its function is to delay the
> exception until the first use of the result, making the point of the
> erroneous calculation harder to trace. In what scenario is this a good
> thing?
if you don't want to deal with specific exceptions

  xint::integer foo();
  //...
  xint::integer i = foo();
  MY_ASSERT(i!=NaN);

> No, it isn't an overflow. An overflow doesn't occur at random, depending on
> some external resource. Overflows are deterministic and depend on the fixed
> range of the number. A 32 bit signed integer always overflows at 2^31. If a
> calculation produces a number X without overflowing, that same calculation,
> when performed again, will still produce X without overflowing. This is not
> true for out of memory conditions. Arguing that making a copy of a number
> can overflow is stranger still.
agree
bad_alloc and the like suit better
i would leave bad_alloc actually (no re-throwing needed)

-- 
Pavel
P.S.
if you notice a grammar mistake or weird phrasing in my message
please point it out

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