Contents|Index|Previous|Next
An
overview of range checking
In some
languages (such as Modula-2), it is an error to exceed the bounds of a
type; this is enforced with run-time checks. Such range checking is meant
to ensure program correctness by making sure computations do not overflow,
or indices on an array element access do not exceed the bounds of the array.
For expressions that you use in GDB commands, you can tell GDB to treat
range errors in one of three ways:
-
ignore them
-
always treat them as errors
and abandon the expression
-
issue warnings but evaluate
the expression anyway
A range error can result from
numerical overflow, from exceeding an array index bound, or when you type
a constant that is not a member of any type. Some languages, however, do
not treat overflows as an error. In many implementations of C, mathematical
overflow causes the result to “wrap around” to lower values—for instance,
if m is the largest integer
value, and s is the smallest,
then, m +1
=> s.
This, too, is specific to
individual languages, and in some cases specific to individual compilers
or machines. See Supported
languages for further details on specific languages.
GDB provides the following
additional commands for controlling the range checker.
Top|Contents|Index|Previous|Next