pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

9 Structures
A structure is a collectively stored set of data items that you can access individually or as a group.
Structures contain structure items (fields) such as simple variables, arrays, simple pointers, structure
pointers, and nested structures (called substructures). The structure items can be of different data
types.
Structures usually contain related data items such as the fields of a file record. For example, in an
inventory control application, a structure might contain an item number, the unit price, and the
quantity on hand.
A structure declaration associates an identifier with one of the kinds of structures listed in Table 41
(page 114).
Table 41 Kinds of Structures
DescriptionStructure
Describes a structure layout and allocates storage for itDefinition
Describes a structure layout but allocates no storage for itTemplate
Allocates storage for a structure whose layout is the same as the layout of a previously
declared structure
Referral
The TNS/E instructions setjmp() and longjmp() require data to be aligned on 16-byte
boundaries. To ensure that this data is aligned on 16-byte boundaries, you must declare it in a
template structure using STRUCTALIGN (MAXALIGN).
Topics:
Structure Layout (page 115)
Overview of Field Alignment (page 117)
Field and Base Alignment (page 119)
Array Alignment in Structures (page 122)
Structure Alignment (page 123)
Substructure Alignment (page 124)
Alignment Considerations for Substructures (page 126)
FIELDALIGN Clause (page 127)
FIELDALIGN Compiler Directive (page 127)
SHARED2 Parameter (page 128)
SHARED8 Parameter (page 129)
Reference Alignment With Structure Pointers (page 134)
STRUCTALIGN (MAXALIGN) Attribute (page 137)
VOLATILE Attribute (page 138)
Declaring Definition Structures (page 138)
Declaring Template Structures (page 139)
Declaring Referral Structures (page 141)
Declaring Simple Variables in Structures (page 142)
Declaring Arrays in Structures (page 143)
Declaring Substructures (page 144)
114 Structures