1.1.5 Classification of Errors
Implementation Requirements
The language definition
classifies errors into several different categories:
Errors that are required to be detected prior to
run time by every Ada implementation;
These errors correspond to any violation
of a rule given in this International Standard, other than those listed
below. In particular, violation of any rule that uses the terms shall,
allowed, permitted, legal, or illegal belongs to this category. Any program
that contains such an error is not a legal Ada program; on the other
hand, the fact that a program is legal does not mean, per se,
that the program is free from other forms of error.
The
rules are further classified as either compile time rules, or post compilation
rules, depending on whether a violation has to be detected at the time
a compilation unit is submitted to the compiler, or may be postponed
until the time a compilation unit is incorporated into a partition of
a program.
Errors that are required to be detected at run
time by the execution of an Ada program;
The
corresponding error situations are associated with the names of the predefined
exceptions. Every Ada compiler is required to generate code that raises
the corresponding exception if such an error situation arises during
program execution. If such an error situation is certain to arise in
every execution of a construct, then an implementation is allowed (although
not required) to report this fact at compilation time.
Bounded errors;
The language rules define certain kinds
of errors that need not be detected either prior to or during run time,
but if not detected, the range of possible effects shall be bounded.
The errors of this category are called
bounded
errors.
The possible effects of a given bounded
error are specified for each such error, but in any case one possible
effect of a bounded error is the raising of the exception Program_Error.
Erroneous execution.
In addition to bounded
errors, the language rules define certain kinds of errors as leading
to
erroneous execution. Like bounded errors, the implementation
need not detect such errors either prior to or during run time. Unlike
bounded errors, there is no language-specified bound on the possible
effect of erroneous execution; the effect is in general not predictable.
Implementation Permissions
An implementation
may provide
nonstandard modes of operation. Typically these modes
would be selected by a
pragma
or by a command line switch when the compiler is invoked. When operating
in a nonstandard mode, the implementation may reject
compilation_units
that do not conform to additional requirements associated with the mode,
such as an excessive number of warnings or violation of coding style
guidelines. Similarly, in a nonstandard mode, the implementation may
apply special optimizations or alternative algorithms that are only meaningful
for programs that satisfy certain criteria specified by the implementation.
In any case, an implementation
shall support a
standard mode that conforms to the requirements
of this International Standard; in particular, in the standard mode,
all legal
compilation_units
shall be accepted.
Implementation Advice
If an implementation detects
a bounded error or erroneous execution, it should raise Program_Error.