Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - 292 array index out of range http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 292                 Array index out of range
------------------------------------------------------------------------------
 Description
   This error occurs when the code attempted to index an array element that
   is out of bounds for the particular array.

   Arrays in Force are 0 based, a feature identical to the C language,
   but different from Clipper (where arrays are 1-based). The most common
   reason for an out-of-bound error to occur is to declare an array with a
   given number of elements, then access the element of the array which is
   indexed with the same number, as demonstrated in the code fragment below.

   vardef
      uint aNumbers[ 10 ] // array with 10 elements
   enddef
   aNumbers[ 0 ]  := 1    // access the first element with index number 0
   aNumbers[ 9 ]  := 10   // access the last element with index number 9
   aNumbers[ 10 ] := 11   // attempt to access the 11st element, which
                          // does not exist

   The Force compiler encodes array range checking by default. Out-of-bounds
   errors are a result of this service. Checking arrays can be disabled
   by using the -Ga compiler switch, in which case accessing the wrong
   elements in arrays will result in more or less obvious program bugs.

 Solution
   Only access the valid range of array elements.

See Also: -Ga

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson