Boost logo

Boost :

Subject: Re: [boost] [xint] Design Question
From: Chad Nelson (chad.thecomfychair_at_[hidden])
Date: 2010-07-09 10:20:31


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10-07-09 02:27 AM, OvermindDL1 wrote:

>> Working on this option now. After looking at it, removing the
>> binary operator- seems rather harsh... if you know that a number is
>> larger than what you're subtracting from it, it would just be
>> irritating. But I'll definitely add the absdiff function (maybe
>> named "difference"?), then the developer using the library can
>> decide which to use for himself.
>
> Why not just go the simple route and define it as "undefined
> behaviour", then just pretend they will never get a negative number
> and let your math functions choke on it as they wish, making invalid
> values, dividing by zero, whatever, it is "undefined behaviour"
> after all.

For something as simple and common as subtraction, that seems rather
harsh too. But in any case, the problem is solved; when you declare an
integer to be unsigned, you also have to tell it how to handle
operations that result in negative numbers.
- --
Chad Nelson
Oak Circle Software, Inc.
*
*
*
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkw3MCoACgkQp9x9jeZ9/wQ8JACgijcm+lyLXn5UJf3z/L/Bd3lm
xyUAoIl6EqgCW3FsfR8ldjhTVo/EgEfj
=Wxp+
-----END PGP SIGNATURE-----


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