From: Maarten Kronenburg (M.Kronenburg_at_[hidden])
Date: 2006-05-26 10:23:58
Yes I read the item "Make sure public inheritance
Therefore I told you that an unsigned integer
is an integer.
Negating an unsigned integer with value zero is
Negating a unsigned integer that is not zero is like
taking the square root of a negative integer.
Subtracting unsigned_integer 12 from 10 must also
throw an exception.
That is what an unsigned_integer is: it cannot be negative.
The wrap around option, like unsigned int
10 - 12 = 2^32 - 2, is actually a modular_integer
with modulus 2^32.
But the unsigned_integer does not have any modulus,
because it is infinite precision.
When users subtract unsigned int 12 from 10, I am sure
they will be surprised to get 4294967294 (at least I was).
Actually the unsigned int is a modular int with modulus 2^32.
The unsigned_integer is an integer with some checks
preventing it to become negative.
In my opinion these checks are as common as checks
preventing taking negative square roots or dividing
"Gerhard Wesp" <gwesp_at_[hidden]> wrote in message
> On Fri, May 26, 2006 at 01:26:00PM +0200, Maarten Kronenburg wrote:
> > Every unsigned integer is an integer,
> Of course.
> But, e.g., negate() doesn't make sense for an unsigned integer, right?
> I can't do any better job than Scott to explain all this, I highly
> recommend you to read the respective chapter (if you didn't do so
> already). Perhaps it changes your mind.
> Gerhard Wesp
> ZRH office voice: +41 (0)44 668 1878
> ZRH office fax: +41 (0)44 200 1818
> For the rest I claim that raw pointers must be abolished.
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk