Null references (oh no, not again!)
Michiel Helvensteijn
nomail at please.com
Fri Mar 6 11:55:21 PST 2009
Walter Bright wrote:
> With overflow, there are legitimate uses of overflow arithmetic. You'd
> be hard pressed to make a statement like "overflow arithmetic is illegal
> in D" and have a useful systems programming language.
Seems to me that in the general case, programmers want 'normal' integer
arithmetic. Overflow arithmetic would be a special case. I would suggest
the following:
* Overflow checking should be on by default.
* It may optionally be turned off for release mode.
* Introduce a special type for overflow arithmetic: mod_int!(lower, upper).
Static code analysis is getting better and better. And as such, in more and
more cases it becomes possible to prove that an overflow is impossible. In
those cases, the runtime check can be left out even in debug mode. I myself
am doing research in that direction.
--
Michiel
More information about the Digitalmars-d
mailing list