On Tue, 26 Mar 2013 13:56:35 -0400, Luís Marques <[email protected]> wrote:

BTW, as far as I can see the overflow/underflow behavior never got specified by the language, in any case:

1) http://forum.dlang.org/thread/[email protected] <-- no conclusion

2) Andrei's book doesn't seem to mention the topic.

If it is specified somewhere please do tell. Whatever the behavior should be (unspecified, modulus for unsigned integers, etc) there really should be an official stance.

The official stance is, it's not an error. If we treated it as an error, then it would be very costly to implement, every operation would have to check for overflow. The CPU does not assist in this.

You can construct an "overflow-detecting" integer type that should be able to do what you want.

-Steve

Reply via email to