Non-recoverable Internal Errors
Non-recoverable internal errors share the following distinguishing characteristics. They are:
*Easily predicted in advance
*Encountered at relatively low levels
*Costly to detect
*Detected only in the debug version of the library
Non-recoverable internal errors by definition have no recovery mechanism. Examples of these errors include bounds errors and inserting a null pointer into a collection.
A library defines some errors unrecoverable because detecting errors takes time. For performance reasons, a library demands a minimal level of accuracy and rejects any part of your program that falls short. Errors are non-recoverable in the sense that the production version of the library has no mechanism for detecting such errors. This means there is no opportunity to recover from them.
Bounds errors are non-recoverable because the cost of checking that an index is in range can well exceed the cost of the array access itself. If a program does a lot of array accesses, checking every one may result in a slow program. To avoid this, the library may require you to always use a valid index. Because a minimum level of accuracy is demanded, non-recoverable errors are simple in concept and relatively easy to avoid.
You can best discover and eliminate non-recoverable errors by compiling and linking your application with the debug version of the library. See The Debug Version of the Essential Tools Module in this chapter for details. The debug version includes extra checks designed to uncover coding errors. Some of these checks may take extra time, or even cause debug messages to be printed. For this reason, you will want to compile and link with the production version for an efficient final product. If the debug version of the library discovers an error, it typically aborts the program.