C/C++ Programmer's Guide (G06.25+)
Compiler Pragmas
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
13-77
REFALIGNED
REFALIGNED
The REFALIGNED pragma specifies the default reference alignment for pointers in
native C and C++ programs.
The pragma default settings are:
Usage Guidelines
•
The REFALIGNED pragma can be entered on the compiler RUN command line or
in the source text, or it can be specified with the -Wrefalign flag of the c89
utility.
•
In native mode, if you specify REFALIGNED on the command line, you cannot
include a pointer-name-list. A list is permitted only when the pragma appears
in the source text.
•
The default code generation for pointer dereferencing operations (REFALIGNED 8)
expects the pointer to contain an address that satisfies the alignment requirements
of the object being pointed to.
For example, a 4-byte object should have an address that is a multiple of 4. If the
object is at an address that does not satisfy its alignment requirements, the default
code generation causes a compatibility trap. To avoid this, specify REFALIGNED 2
on the pointer to the object. This results in code generation that assumes the
dereferenced object is not properly aligned and compensates for the misalignment.
REFALIGNED value [ pointer-name-list ]
value:
{ 2 | 8 }
pointer-name-list:
pointer-name [ pointer-name-list ]
pointer-name:
{ type-name | variable-name }
SYSTYPE GUARDIAN SYSTYPE OSS
TNS C compiler N.A. N.A.
G-series TNS c89 utility N.A. N.A.
TNS/R native C and C++ compilers REFALIGNED 8 REFALIGNED 8
Native c89 utility REFALIGNED 8 REFALIGNED 8
TNS/E native C and C++ compilers REFALIGNED 8 REFALIGNED 8