<div>I can agree that in some circumstances, a ranged and saturated integer mode would be REALLY handy (colours, sound samples), but I can't buy in with the whole trapping overflows and stuff... most architectures will require explicit checking of the overflow bit after every operation to support this. Also, contrary to his claim, I find that wrapping is usually what I DO want in this case..</div>
<div>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. If I'm dealing with integers that big, chances are I'm dealing with memory ranges, bit masks, or some compression/crypto type thing where the algorithms depend on it. Not only am I aware of the wrapping behaviour, it's usually the intent...</div>
<br><div class="gmail_quote">On 5 December 2011 18:37, Don <span dir="ltr"><<a href="mailto:nospam@nospam.com">nospam@nospam.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="HOEnZb"><div class="h5">On 05.12.2011 14:31, bearophile wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Found through Reddit, two blog posts about how integers should behave in system languages (with hardware support):<br>
<br>
<a href="http://blog.regehr.org/archives/641" target="_blank">http://blog.regehr.org/<u></u>archives/641</a><br>
<a href="http://blog.regehr.org/archives/642" target="_blank">http://blog.regehr.org/<u></u>archives/642</a><br>
<br>
Bye,<br>
bearophile<br>
</blockquote>
<br></div></div>
Not very convincing, since he proposes a change to existing architectures, and seems completely unaware of the overflow flag.<br>
If you can change existing architectures, why not simply allow an exception to be generated if an overflow occurs?<br>
<br>
Doesn't seem at all helpful to D.<br>
</blockquote></div><br>