K
Keith Thompson
Bartc said:[...]
I don't know. Integer overflow doesn't seem serious enough to warrant
hardware support.
[...]You'd rather have wrong answers quickly?Yes. Integer operations need to be fast. Overflow checking should be
optional, perhaps during development only.
[...]
Well, luckily for you, C does require overflow checking for operations
on signed integers, and mandates well-defined behavior when the checks
fail, and zero run-time overhead when they don't.
About which C you talking about?
The C89 Ansi C standard states:
The handling of overflow, divide check and other exceptions
in expression evaluation is not defined by the language.
Most existing implementations of C ignore overflow in
evaluation of signed integral expressions and assignments,
but this behavior is not guaranteed.
Sorry, I guess I was being more suble than I thought I was.
The paragraph I wrote above, starting with "Well, luckily for you", is
completely and deliberately false. I followed it with:
But you might want to verify that information. I though it was
more important to post a followup quickly than to get it right.
I was trying (apparently not completely successfully) to make a point
about the attitude that getting *quick* answers is more important than
getting *correct* answers, and drawing a parallel between performing
arithmetic without checking for overflow, and posting followups
without checking for accuracy.