TAL Reference Manual

Arrays
TAL Reference Manual526371-001
7-3
Usage Considerations
elements, the values of uninitialized elements are undefined. You cannot initialize
extended indirect local arrays or UNSIGNED arrays.
Specify initialization values that are appropriate for the data type of the array. For
example, if the decimal setting of an initialization value differs from the
fpoint of a
FIXED array, the system scales the initialization value to match the
fpoint. If the
initialization value is scaled down, some precision is lost.
Usage Considerations
UNSIGNED arrays and sublocal arrays must be directly addressed. For most other
arrays, you should use indirection because storage areas for direct global and local
data are limited. For very large arrays, use extended indirection. You access indirect
data by identifier as you do direct data.
The data type determines:
The kind of values that are appropriate for the array
The storage unit the compiler allocates for each array element as follows:
Examples of Array Declarations
1. These examples declare arrays with various bounds. The arrays are indirectly
addressed except the UNSIGNED array, which must be directly addressed:
FIXED .array_a[0:3]; !Four-element array
INT .array_b[0:49]; !Fifty-element array
UNSIGNED(1) flags[0:15]; !Array of 16 one-bit elements
2. These examples declare arrays and initialize them with constants:
INT a_array[0:3] := -1; !Store -1 in element [0];
!values in elements [1:3]
!are undefined
INT b_array[0:1] := "abcd"; !Store one character per byte
Data Type Storage Unit
STRING Byte
INT Word
INT (32) or REAL Doubleword
REAL (64) or FIXED Quadrupleword
UNSIGNED Sequence of 1, 2, 4, or 8 bits