Bounds Checking - Range Checking

Range Checking

A range check is a check to make sure a number is within a certain range, for instance that a value about to be assigned to say a sixteen-bit integer is within the capacity of a sixteen-bit integer. This is not quite the same as type checking. Other range checks may be more restrictive, for example a variable to hold the number of a calendar month may be declared to accept only the range 1 to 12. This is often used with arrays, as using a number outside of the upper range in an array may cause the program to crash, or may introduce security vulnerabilities (see buffer overflow). In Java, the interpreter automatically does a range-check when items in an array are accessed, and throws an exception if the item is out of range.

Read more about this topic:  Bounds Checking

Famous quotes containing the word range:

    During the cattle drives, Texas cowboy music came into national significance. Its practical purpose is well known—it was used primarily to keep the herds quiet at night, for often a ballad sung loudly and continuously enough might prevent a stampede. However, the cowboy also sang because he liked to sing.... In this music of the range and trail is “the grayness of the prairies, the mournful minor note of a Texas norther, and a rhythm that fits the gait of the cowboy’s pony.”
    —Administration in the State of Texa, U.S. public relief program (1935-1943)