Boost logo

Boost :

Subject: Re: [boost] New Boost.XInt Library, request preliminary review
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2010-03-30 17:47:28


On 30 March 2010 17:40, Chad Nelson <chad.thecomfychair_at_[hidden]> wrote:
>
> Well, it's not called an "infinite range integer," after all. :-) Just
> an unlimited one, because the library does not place any limits on it.
> Only available memory, and the time needed to operate on something that
> large, do.
>

The library *does* impose a limit: It has to allocate space, so
there's necessarily the limit implied by the size of the type passed
to the allocator to request the space.

Take, for instance:

    pow(xint(-1u), xint(-1u))

That should probably throw an overflow error from checking ahead of
time that the amount of memory requested is infeasible in the same way
as std::vector<int>(-1) will throw a std::length_error.

(Yes, I agree that it's not a limit anyone should ever be hitting in
useful programs, but...)


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