pTAL Reference Manual (H06.03+)
Arrays
HP pTAL Reference Manual—523746-005
8-8
Using Constant Lists in Array Declarations
Using Constant Lists in Array Declarations
pTAL requirements for array declarations are:
•
If an array declaration includes an initialization string, the size of a constant list
must be less than or equal to the size of the array. If the constant list is larger than
the array, an error occurs.
•
If the alignment of the elements of the initialization string under SHARED2 rules
and SHARED8 rules is different, you must specify a FIELDALIGN clause in the
initialization string.
The number of bits in a constant list that you assign to a read-write array must be the
same as the number of bits in the array. The number of bits in a constant list that you
assign to a read-only array must be the less than or equal to the number of bits in the
array.
Topics:
•
Read-Only Arrays on page 8-8
•
Nonstring Arrays on page 8-9
Read-Only Arrays
The number of bits in the initialization string must equal the number of bits in the read-
only array.
If the read-only-array declaration does not specify array bounds, the number of bits in
the initialization string must be an integral multiple of the number of bits in the array’s
base type.
Example 8-9. Declaring Read-Only Arrays With Constant Lists
INT p = 'P' := "abcd"; ! OK
INT q[0:3] = 'P' := "abcdabcd"; ! OK
STRING r = 'P' := "abcd"; ! OK
STRING s[0:3] = 'P' := "abcd"; ! OK
STRING t = 'P' := [1,2,3]; ! OK
STRING u[0:3] = 'P' := [1,2,3]; ! ERROR: Initialization size
! (24 bits) must equal the
! array's size (32 bits)
STRING v = 'P' := [1,2,3,4]; ! OK
STRING w[0:3] = 'P' := [1,2,3,4]; ! OK
INT x = 'P' := "abc"; ! ERROR: Initialization size
! must be an integral
! multiple of array's base
! type size










