$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] New Boost.XInt Library, request preliminary review
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2010-03-30 11:27:03
On 30 March 2010 10:23, Chad Nelson <chad.thecomfychair_at_[hidden]> wrote:
>
> If that was aimed at XInt, note its purpose: it's intended to allow
> calculation with numbers of arbitrary length, up to the memory size of
> the system. If the system can't provide enough memory for it at some
> point, that *is* an overflow -- the number is too large to represent.
>
> That definition is already used in Boost as well, in the Boost.Math
> library: "Overflow Error: Occurs when the result is either infinite, or
> too large to represent in the numeric type being returned by the function."
>
I disagree.
Consider, for instance, [lib.basic.string]/4a in C++03:
For any string operation, if as a result of the operation,
size() would exceed max_size() then the operation
throws length_error.
That, in my opinion, is the equivalent of an overflow. The type is
fundamentally *incapable* of representing such a large string/number.
Note that it's a distinct exception from bad_alloc, which states that
the type *could* represent the value requested, if only the memory
allocator would give it what it asked for.