Data Definition Language (DDL) Reference Manual — 426798-002
H- 1
H
DDL Alignment Rules
This section provides information about alignment rules used by the DDL compiler
when generating C code.
The DDL compiler supports four types of alignment rules:
•
Default alignment rules for C00 and later versions of the C compiler. To use these
rules, specify the C00CALIGN compiler command.
•
Default alignment rules for versions of the C compiler prior to C00. To use these
rules, specify the NOC00CALIGN compiler command.
•
Default alignment rules for compatibility with pTAL or TAL structures. To use these
rules, specify the CMATCH_HISTORIC_TAL compiler command.
•
Default alignment rules for compatibility with C structures. To use these rules,
specify the FIELDALIGN_SHARED8 compiler command.
If you do not specify a set of alignment rules, the DDL compiler uses C00CALIGN as
the default.
The following subsections describe the three types of alignment rules.
C00CALIGN Alignment Rules
C00 and later versions of the C compiler adhere to the following rules:
•
All structures and nested substructures begin and end on an even byte boundary.
•
When a CHAR or CHAR ARRAY item directly follows another CHAR or CHAR
ARRAY item, no filler exists between them. (This rule does not apply if the first
CHAR data is within a substructure and the second is outside of the structure.)
For example, the following structure definition specifies four bytes of data CHAR
b
begins at offset three within STRUCTs.
struct
{
char a[3];
char b;
} s;
In the next example,
s1.y
starts at offset four; C adds a byte of filler at the end of the
nested STRUCT:
struct
{
struct
Note. The DDL compiler does not generate C output for a structure definition if the alignment
is not compatible to that of other languages. Incompatibility can occur if, for example, the C
compiler adds implicit FILLER bytes to a structure wherever DDL does not add FILLER bytes.