Lints, Condate and bugs

Walter Bright newshound2 at digitalmars.com
Thu Oct 28 12:04:26 PDT 2010


dsimcha wrote:
> I don't consider it a high priority because I've found that integer overflow is
> such an uncommon bug in practice, but I would like to have overflow and sign
> checking in D eventually.  As long as it can be disabled by a compiler switch for
> a whole program, or an annotation for a single performance-critical function, you
> can still have your safety the 90% of the time when the hit doesn't matter and
> only live dangerously when you gain something in the tradeoff.

I agree that overflow is a pretty rare issue and way down the list. With 64 bit 
targets, it's probably several orders of magnitude even less of an issue.

Of far more interest are improving abstraction abilities to prevent logic errors.

It's also possible in D to build a "SafeInt" library type that will check for 
overflow. These classes exist for C++, but nobody seems to have much interest in 
them.

Another way to deal with this is to use Don's most excellent std.bigint 
arbitrary precision integer data type. It can't overflow.


More information about the Digitalmars-d mailing list