Contents | Prev | Next

18.2 Array index out of bounds

Official Description

6.5.3.2 For an indexed-variable closest-containing a single index-expression, it is an error if the value of the index-expression is not assignment-compatible with the index-type of the array-type.

Simplified Description

In other words, it is error to access an array component that does not exist. For example given:

   var a : array[1..20] of char;

then

   a[0]

is an error since the index-expression (i.e. 0) is not assignment-compatible with the index-type (i.e. 1..10) of the array type. NOTE: There is no 0th component of the array a.

Error Handling

This error is reported if range checking is enabled.

Contents | Prev | Next