pTAL Conversion Guide

pTAL Conversion Guide527302-002
9-1
9 Arrays
Topics:
Read-Only Arrays on page 9-1
Constant Lists in Array Declarations on page 9-2
Arrays of Addresses on page 9-4
Read-Only Arrays
The data in a read-only array (also called a P-relative array) is stored in a user code
segment. Programs can read data from read-only arrays but cannot write to them.
TAL
A read-only array can be direct or indirect—the TAL compiler generates the same code
for both cases.
pTAL
If a read-only array declaration specifies an indirection symbol (.), the native compiler
issues a warning. The data type of a read-only array cannot be an address type.
Example 9-1. Read-Only Array Declarations (pTAL)
Invalid:
PROC p;
BEGIN
INT .j = 'P' := [5,6,7]; ! WARNING
STRING .l = 'P' := ["ccc"]; ! WARNING
BADDR b = 'P' := [0, 0]; ! ERROR: Address type is invalid
! as type of read-only array
END;
Valid:
PROC p;
BEGIN
INT i = 'P' := [2,3,4];
STRING k = 'P' := ["abc"];
END;