Data Definition Language (DDL) Reference Manual
DDL Alignment Rules for C
Data Definition Language (DDL) Reference Manual—529431-004
H-2
C00CALIGN Alignment Rules
C00CALIGN Alignment Rules
These are the default alignment rules.
C00 and later versions of the C compiler follow these 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 (see Example H-1 on page H-2).
This rule does not apply if the first CHAR data is within a substructure and the
second is outside of the structure (see Example H-2 on page H-2).
When C00CALIGN is in effect, the DDL compiler does not generate C output for a
structure that contains one of the following:
•
A substructure that begins on an odd byte boundary.
•
A structure that ends on an odd byte boundary and is followed by a user-defined
item that the DDL compiler allocates starting on an odd byte.
Example H-1. C00CALIGN Alignment With Character Inside Structure
struct
{
char a[3];
char b; ! Starts at offset 3
} s;
Example H-2. C00CALIGN Alignment With Character Outside Structure
struct
{
struct
{
char x[3];
} ss2; ! C adds a filler byte at the of ss2
char y; ! Starts at offset 4
} s1;
Note. The term substructure refers to a structure or union within a structure definition. The
only data that the DDL compiler allocates starting on an odd byte is character data.