Please note that the content of this book primarily consists of articles
available from Wikipedia or other free sources online. In computer
programming, bounds checking is any method of detecting whether a
variable is within some bounds before its use. It is particularly
relevant to a variable used as an index into an array to ensure its
value lies within the bounds of the array. For example: a value of 32768
about to be assigned to a sixteen-bit signed integer variable, or
accessing element 25 on an array with index range 0 through 9 only. The
first is also known as range checking, the second as index checking. A
failed bounds check usually results in the generation of some sort of
exception signal. Because performing bounds checking during every usage
is time-consuming it is not always done. Bounds-checking elimination are
compiler technologies that eliminate unneeded bounds checking in many
common cases.