General Compiler Directive: Affects data alignment and warnings about data alignment.
Syntax
Controls whether warnings are issued by the compiler for data that is not naturally aligned. By default, you receive compiler messages when misaligned data is encountered (/WARN=ALIGNMENT).
Controls alignment of fields in record structures and data items in common blocks. The fields and data items can be naturally aligned (for performance reasons) or they can be packed together on arbitrary byte boundaries.
p
Is a specifier with one of the following forms:
[class = ] rule
(class = rule,...)
ALL
NONE
class
Is one of the following keywords:
rule
Is one of the following keywords:
ALL
Is the same as specifying OPTIONS /ALIGN, OPTIONS /ALIGN=NATURAL, and
OPTIONS /ALIGN=(RECORDS=NATURAL,COMMONS=NATURAL).
NONE
Is the same as specifying OPTIONS /NOALIGN, OPTIONS /ALIGN=PACKED, and
OPTIONS /ALIGN=(RECORDS=PACKED,COMMONS=PACKED).
Rules and Behavior
The OPTIONS (and accompanying END OPTIONS) directives must come after OPTIONS, SUBROUTINE, FUNCTION, and BLOCK DATA statements (if any) in the program unit, and before the executable part of the program unit.
The OPTIONS directive supersedes the /alignment compiler option.
For performance reasons, Compaq Fortran aligns local data items on natural boundaries. However, EQUIVALENCE, COMMON, RECORD, and STRUCTURE data declaration statements can force misaligned data. If cDEC$ OPTIONS/WARN=NOALIGNMENT is specified, warnings will not be issued if misaligned data is encountered.
If you want aligned data in common blocks, do one of the following:
If you want packed, unaligned data in a record structure, do one of the following:
See Also: General Compiler Directives
Example
! directives can be nested up to 100 levels
CDEC$ OPTIONS /ALIGN=PACKED ! Start of Group A
declarations
CDEC$ OPTIONS /ALIGN=RECO=NATU ! Start of nested Group B
more declarations
CDEC$ END OPTIONS ! End of Group B
still more declarations
CDEC$ END OPTIONS ! End of Group A
The CDEC$ OPTIONS specification for Group B only applies to RECORDS; common blocks within Group B will be PACKED. This is because COMMONS retains the previous setting (in this case, from the Group A specification).