TAL Reference Manual

Arrays
TAL Reference Manual526371-001
7-6
Usage Considerations
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
Because code segments have no primary or secondary areas, read-only arrays must
be direct. If you declare an indirect read-only array, the compiler ignores the indirection
symbol and issues warning 37 (array access changed from indirect to direct).
You must initialize read-only arrays. UNSIGNED read-only arrays are not allowed,
because they cannot be initialized.
If you declare a read-only array in a RESIDENT procedure, the array is also resident in
main memory.
Binder binds each global read-only array into any code segment containing a
procedure that references the array.
The
TAL Programmer’s Guide gives information on accessing read-only arrays. In
summary, you can access read-only arrays as you access any other array, except that:
You cannot modify a read-only array; that is, you cannot specify a read-only array
on the left side of an assignment or move operator.
You cannot specify a read-only array on the left side of a group comparison
expression.
In a SCAN or RSCAN statement, you cannot use next-addr to read the last
character of a string. You can use next-addr to compute the length of the string.
Example of Read-Only Array Declaration
This example declares read-only arrays using default lower and upper bounds and
initializes them with constant lists:
STRING prompt = 'P' := ["Enter Character: ", 0];
INT error = 'P' := ["INCORRECT INPUT"];