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

SHARED8
FIELDALIGN(SHARED8) directs the compiler to allocate the structure’s fields for optimal performance
in pTAL. Specify FIELDALIGN(SHARED8) when:
You want optimal performance in pTAL.
The fields you reference in the structure are well-aligned.
All processes that share the data can use SHARED8 alignment.
You want the structure to hold data (for example, interprocess messages, memory, or files)
that is shared by processes or applications that are composed of both pTAL and TAL code.
In TAL, access to SHARED8 components is as efficient as access to SHARED2 components,
but SHARED8 components usually require more space than SHARED2 components.
For more information, see FIELDALIGN Clause (page 127) and SHARED8 Parameter (page 129).
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.
Specify FIELDALIGN(AUTO) for structures that are not used to exchange data between processes.
118 Structures