> it ought to be easy to work out from that whether 2^500 is safe.

For simple cases, yes you can determine in advance when you overflow, even 
statically at compilation time. But even for simple functions like [Ackermann 
function](http://rosettacode.org/wiki/Ackermann_function#Nim) or the [Hailstone 
sequence](http://rosettacode.org/wiki/Hailstone_sequence), it can be difficult 
determining when it overflows or not.

One of the reasons why the exception mechanism is important even for overflow 
is that it lets the programmer decide the locality of error management (in that 
case overflow). Returning a status code like in C library has show that 
programmers usually don't test results after each calls. And if they do, the 
resulting source is mostly errors processing... Implementing a global signal 
handler has often a too large scope and resuming is too difficult. Exceptions 
trapping has been successful letting the programmer decide the scope where they 
apply, being a single line or a whole program, and how to resume from their 
capture (depending on the language).

Finding in advance if an overflow will occur is the way to go when possible. 
But unfortunately, there are many occasions when it's not possible. And 
exceptions are the nicest error management system for the moment.

Reply via email to