Mirsad Todorovac wrote:
Not really. Range-checking will at best generate runtime errors, not correct the problems automatically. If Ariane's software would have generated an error (even it if was an exception that could be handled), it's quite unlikely that it could've found the cause of the problem and corrected it (in real-time, therefore fully automatically!).
Here I'd always leave the possibility to programmer whether to compile-in range checking or not. Yet, in Arianne example, if you get runtime errors, it doesn't have to end execution, some errors may be recoverable.
Yes, but you have to code it yourself. And then it doesn't make that big difference if you write something like:
procedure ErrorHandler; begin CorrectValues ... end;
[...] InstallErrorHandler ... Foo := Bar;
or:
if (Bar >= Minimum) and (Bar <= Maximum) then Foo := Bar else CorrectValues
In fact, the second one seems easier here, and does not require any non-standard features for error handling.
For example, life-support computers and similar applications can't just say "panic: freeing free inode: syncing file systems ..." (common message on SunOS 4.1.x :-) ... ). But to allow for error to go undetected is neither a good solution.
Again, you'd need something more complex. Detecting the error (which could be automated) is the easier bit. Carrying on with reasonable behaviour in every possible case of error (possibly even multiple errors) is much harder.
Yes, but UCSD pascal had it back then in 1987. If it can be switched on and off with compiler directive, I can't see why not?
I didn't say it wasn't a useful feature.
For example, who excludes floating-point checks to make code run faster and get a matrix full of NaN (not-a-number) as a result?
Just as useful as a runtime error abort in the middle. If you assume that the error occurs in the middle (statistically), and the check would make it run twice as slow, it would take the same time (I know, very rough estimation ;-).
With the editor example you have a point - but writer of the editor could disable runtime checks in production binary.
As I said, a debugging tool ...
Frank