|
 |
"Warp" <war### [at] tag povray org> wrote in message
news:481a2348@news.povray.org...
> . wrote:
> > "Orchid XP v8" <voi### [at] dev null> wrote
> > > Unfortunately, it has become common for programs to give messages such
> > > as "an unexpected error has occurred. Sorry."
> > >
> > > [BTW, WTF is an *expected* error anyway??]
> > Actually, the above *is* an example of an expected error (the programmer
put
> > that message in, didn't he?). Unexpected errors either go unnoticed or
crash
> > the system.
> Wrong. Unexpected errors are things which should never happen, and if
> they do
Want to rephrase that? <g>
> the indicate a bug in the program.
> Typical example:
>
> switch(something)
> {
> case A: ...
> case B: ...
> ...
>
> default:
> error("Unexpected error happened.");
> // This should never happen because all possible cases were dealt
above.
> // If we ever get here, it's a clear sign of a bug in the program.
> }
No, the error is either expected, but programmer shows bad form (ie, the
programmer anticipates "illegal" input but doesn't check it at the procedure
entry, and instead does it inside program logic) or a pointless exercise, as
in:
If ((X=True)=True)=True Then ... //just making sure!...
or
If X=4 Then
...
Else if X<>4 Then
...
Else
Exception()..
Sure, QM, if nothing else, tells us that there are no guarantees, but it's
pointless to expect an error where it cannot logically be, or raise
exceptions in places that cannot logically be reached. Conversely, under
abnormal circumstances, all opcodes are suspect.
I agree, however, that "unexpected errors" are bugs.
PS. Yes, I know, some programming languages are perverse enough that the
code above makes sense.
Post a reply to this message
|
 |