HP C/iX Reference Manual (31506-90011)

Chapter 9 151
HP C/iX Implementation Topics
Type Mismatches in External Names
Type Mismatches in External Names
It is illegal to declare two externally visible identifiers of different types with the same
name in separately compiled translation units. The linker might not diagnose such a
mismatch.
Data Alignment Pragma
This section discusses the HP_ALIGN data alignment pragma and the differences between
the data alignment architectures of the MPE/iX and MPE/V systems.
The HP_ALIGN data alignment pragma allows you to control the alignment of fields within
structures and unions. It facilitates the interchange of data between MPE systems having
different data alignment architectures.
Data alignment architectures specify the number of bits allocated to store various data
types, whether a data type is aligned on a byte, two-byte, word, or double word boundary,
and padding among bit-fields. The differences in data alignment architectures are
especially important to consider when passing data from one machine to another.
The HP_ALIGN pragma facilitates transferring data among MPE V and MPE/iX systems
and when accessing TurboImage databases from HP C/iX.
The syntax for the HP_ALIGN pragma is:
[#pragma HP_ALIGN {MPE_16POP}]
The MPE_16 option directs the HP C/iX compiler to set the alignment of int, float, and
double in structures and unions to be aligned according to the MPE/V alignment scheme.
This option also sets the alignment of structures and unions to start and end on at least a
half-word boundary.
The POP option turns off the HP_ALIGN pragma and alignment reverts to word (32-bit)
alignment. For example:
#pragma HP_ALIGN MPE_16
struct {char a; double b; int c;} d;
#pragma HP_ALIGN POP
Comparison of MPE/V and MPE/iX Data Alignment
MPE/V systems align data within structures and unions differently than MPE/iX systems.
The data alignment rules for these two systems are described using the following code
fragment for comparison purposes: