C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Compiler Pragmas
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
13-29
FIELDALIGN
°
Use the default value for EXTERN_DATA, which is NO_GP.
°
Use the correct header file to declare the SRL data.
°
Add a #pragma extern_data no_gp SRL-variable-name for each SRL
data object that the program explicitly declares.
EXTERN_DATA has no effect if the compilation specifies the SRL directive.
Examples
/* “excerpt” from <errno.h> */
#pragma push extern_data
#pragma extern_data no_gp
extern int errno; /* References to errno will not use
GP-relative addressing. */
#pragma pop extern_data
/* alternative form */
extern int errno;
#pragma extern_data no_gp errno
FIELDALIGN
The FIELDALIGN pragma controls the component layout of structures for compatibility
between TNS and native structure layout and for compatibility with native mixed-
language structure layout.
align-attribute
specifies the alignment rules for the compiler to follow. Valid values are:
AUTO
directs the compiler to choose the layout scheme. The compiler might add
implicit (anonymous) fillers to ensure that components are properly aligned.
This is the default alignment. The TNS C compiler and the native C and C++
compilers have different AUTO alignment rules.
FIELDALIGN align-attribute [ tag-list ]
align-attribute:
{ AUTO | CSHARED2 | SHARED2 | SHARED8 | PLATFORM }
tag-list:
tag-name [ tag-list ]