Lints, Condate and bugs
dsimcha
dsimcha at yahoo.com
Thu Oct 28 11:12:10 PDT 2010
== Quote from Walter Bright (newshound2 at digitalmars.com)'s article
> bearophile wrote:
> >> but what are the big issues with checking for overflows
> >
> > There are no big issues for checking for overflows.
> Consider that every add instruction:
> ADD EAX,3
> becomes 2 instructions:
> ADD EAX,3
> JC overflow
> and every:
> LEA EAX,7[EBX*8][ECX]
> becomes:
> MOV EAX,EBX
> IMUL EAX,3
> JC overflow
> ADD EAX,7
> JC overflow
> ADD EAX,ECX
> JC overflow
> This is not a small penalty. Adds, multiplies, and subtracts are the bread and
> butter of what the executable code is.
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.
More information about the Digitalmars-d
mailing list