pTAL Reference Manual (H06.08+)

Structures
HP pTAL Reference Manual523746-006
9-14
Array Alignment in Structures
An array of structures or substructures is the same as an array of a pTAL data type.
The width of the widest field of an element of such an array, combined with the
FIELDALIGN parameter you specify, determines the required alignment of the
structure or substructure and of its fields.
STRUCT s2 FIELDALIGN(SHARED8);
BEGIN
INT i;
INT a;
INT b;
INT c;
STRUCT s1a;
BEGIN
INT(32)w;
INT y;
INT x;
END;
STRUCT s1b;
BEGIN
INT(32)w;
INT y;
INT x;
END;
END;
Example 9-2. SHARED2: 2-Byte Alignment
STRUCT s1[0:9] FIELDALIGN(SHARED2); ! s1 is SHARED2
BEGIN ! Alignment is 2
INT i;
FILLER 2;
INT(32) j;
END;
Example 9-3. SHARED8: 4-Byte Alignment
STRUCT s2[0:9] FIELDALIGN(SHARED8); ! s2 is SHARED8
BEGIN ! Alignment is 4
INT i;
FILLER 2;
INT(32) j;
END;
Example 9-1. Arrays Within Structures (page 2 of 2)