Talk:Bounds checking

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computing (Rated Start-class)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.

It'd be good if it was discussed what could happen without bounds checking and why this may be dangerous. --Abdull 10:35, 5 November 2005 (UTC)

Different usages[edit]

The article on bounds checking treats the subject as being the same as index checking, but this is not so. Index checking is a subset of bounds checking in that a variable used for indexing an array is checked for having values within the bounds of the array it is being used to index, and different arrays might well have different bounds even though the same variable is used to index them. However, bounds checking is more general and more closely associated with the variable, whereby a value about to be assigned to a variable would be checked for being within the allowed bounds for that variable. A simple situation would be an expression calculated as a 32-bit integer to be stored into a 16-bit variable. Some languages allow a variable to be declared with a specified allowable range (say -3 to 76, or 2.71828 to 3.14159 perhaps, though probably not with more complex ranges) so it is not just a matter of word sizes and suchlike.