ow Integers Should Work

bearophile bearophileHUGS at lycos.com
Mon Dec 5 09:36:44 PST 2011


Manu:

> Also, contrary to his claim, I find that wrapping is usually what I
> DO want in this case..
> It's super rare that I write any code that pushes the limits of an int
> (unless we're talking 8-16 bit, see my range+saturation comment before),
> and when I do write code that pushes the range of an int, I can't think of
> a time when I've not wanted to wrap as expected.

The code you usually write seems rather unusual. I have kind of the opposite situations.

But first of all, "trapping" ints are needed to avoid bugs in normal code. Some bugs are shown here:
http://embed.cs.utah.edu/ioc/

Bye,
bearophile


More information about the Digitalmars-d mailing list