Boost logo

Boost :

Subject: Re: [boost] [xint] Design Question
From: Jeffrey Lee Hellrung, Jr. (jhellrung_at_[hidden])
Date: 2010-06-16 17:31:41


On 6/16/2010 2:30 PM, Chad Nelson wrote:
> On 06/16/2010 02:31 PM, vicente.botet wrote:
>
>>> The problem is: what should the library do if the user asks for an
>>> unsigned *non*-fixed-length integer? [...]
>>
>> What about making the difference between two unsigned integers a
>> signed integer?
>
> That sounds like a useful behavior, but if the developer using the
> library says it should be an unsigned number, I don't think the library
> should override that.

I think Vicente probably had operator- in mind. Then you'd need signed
<-> unsigned conversions, but I'd think that would be expected.

For something like operator-=, it probably makes sense to throw an
exception, or if the policy parameters disable exceptions, the result
should be a singular value. Of course, this could be *another* policy
parameter, as I can see clamp-to-zero also making sense.

I don't think you should disable use of unsigned, arbitrary-length integers.

- Jeff


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