Tools.h++ Manual
18-2 104011 Tandem Computers Incorporated
18
In theory, all of these errors are preventable. For example, the permissible
range of indices for an array is always known, and so a bounds error should be
avoidable. As another example, while your program may not know that a date
is bad, once it has found this out, to use it would be an obvious logic error.
Internal errors are further divided into two categories, dependent on the cost
of error detection and whether or not the error will be detected at runtime:
• Non-recoverable internal errors
• Recoverable internal errors
Non-recoverable internal errors
Detecting errors costs time. For performance reasons, a library may have to
demand some minimal level of correctness on the part of your program.
Anything that falls short we term a non-recoverable internal error. They are
“non-recoverable” because in the production version of the library there is no
attempt to detect such errors and, hence, no opportunity to recover from one.
Distinguishing characteristics:
• Easily predictable in advance.
• Usually occur at a relatively low level.
• Cost of detection is high.
• Detected only in the “debug” version of the library.
Examples:
• Bounds error
• Inserting a nil pointer into a collection
Response:
• No recovery mechanism.