pTAL Reference Manual (H06.08+)
Structures
HP pTAL Reference Manual—523746-006
9-7
PLATFORM
For more information, see FIELDALIGN Clause on page 9-20 and SHARED8
Parameter on page 9-22.
PLATFORM
FIELDALIGN(PLATFORM) directs the compiler to allocate the structure’s fields
according to a layout that is consistent across different programming languages
running on a given architecture. (PLATFORM field alignment is not consistent across
different architectures.) The data might be shared among modules written in different
programming languages, in one of these ways:
•
Running within a single process
•
Running in separate processes, all of which are either pTAL, TAL, or C/C++, but
not a combination of these
pTAL allocates the fields of a PLATFORM structure according to the rules used by the
native mode HP C compiler for PLATFORM layouts; that is:
•
Each field begins at an address that is an integral multiple of the length of the field.
That is, pTAL allocates 1-byte, 2-byte, 4-byte, and 8-byte fields at addresses that
are integral multiples of one, two, four, and eight, respectively.
•
UNSIGNED fields are not necessarily aligned to byte boundaries. They can share
1-byte, 2-byte, and 4-byte containers with other items. An UNSIGNED field,
however, cannot span an address that is an integral multiple of four. If an
UNSIGNED item would span a 4-byte address boundary, the compiler allocates the
UNSIGNED field beginning at the next 4-byte boundary.
•
The alignment of a structure or substructure is the alignment of its widest field,
unless the structure or substructure contains an UNSIGNED field, in which case,
the alignment of the structure or substructure is at least four.
•
The compiler adds bytes, as needed, to the end of a PLATFORM structure or
substructure such that the length of the structure or substructure is an integral
multiple of its widest field.
AUTO
FIELDALIGN(AUTO) directs the compiler to align structure fields for optimal access on
the architecture on which the object file will be run. Specify AUTO only for structures
whose data exists solely within a process. Use PLATFORM to share data across
processes.
Use AUTO field alignment for a structure that you use only locally—that is, only within
a process—not between processes that run on different architectures. (AUTO field
alignment is not consistent across different architectures and compilers.)
A structure’s layout can be different in pTAL, TAL, and C/C++ if the structure describes
data that is used only within a process and only for the duration of the process. In this
case, you can specify AUTO as the FIELDALIGN parameter.










