Re:Subtraction is not comparison
by marcosdumay on Friday December 26, 2014 @11:14AM
(#8799163)
Nobody handles overflow in practice.
There are all kinds of code patterns that are sensitive to overflow, and people do use those patterns because they are simple. A program that does not fail on overflow is something almost illegible, and for most applications the only difference it can make is displaying the correct error message before closing, because the problem domain has no procedure for that.
C programmers are implicitly expected to estimate the value ranges they'll be dealing with, and correctly size their variables.
There are all kinds of code patterns that are sensitive to overflow, and people do use those patterns because they are simple. A program that does not fail on overflow is something almost illegible, and for most applications the only difference it can make is displaying the correct error message before closing, because the problem domain has no procedure for that.
C programmers are implicitly expected to estimate the value ranges they'll be dealing with, and correctly size their variables.