pTAL Reference Manual (H06.08+)
Structures
HP pTAL Reference Manual—523746-006
9-41
Declaring Arrays in Structures
type
is any data type described in Section 3, Data Representation.
identifier
is the identifier of the array.
range
lower-bound
is an INT constant expression (in the range -32,768 through 32,767) that
specifies the index (relative to the zeroth array element) of the first array
element you want allocated. Both lower and upper bounds are required.
upper-bound
is an INT constant expression (in the range -32,768 through 32,767) that
specifies the index (relative to the zeroth array element) of the last array
element you want allocated. Both lower and upper bounds are required.
When you declare arrays inside a structure, the following guidelines apply:
•
You cannot initialize arrays declared in structures. You can assign values to such
arrays only by using assignment statements.
•
You cannot declare indirect arrays or read-only arrays in structures.
•
You can specify array bounds of [n
:
n-1] in structures (for example, [6:5]).
Such an array is called a zero-length array. It is often used to initialize a structure,
as in Example 9-34 on page 9-42. This method of initialization allows you to name
something with the same address as the next “thing” in the list without allocating
data for it, similar to a union or equivalence.
Example 9-33. Arrays Within a Structure
STRUCT record; ! Declare definition structure
BEGIN
STRING name[0:19]; ! Declare arrays within the structure
STRING addr[0:29]; ! layout
INT acct;
END;
[
lower-bound
: ]
upper-bound
VST993.vsd










