== Quote from Walter Bright ([email protected])'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.
