cDEC$ PACK
Specifies the memory starting addresses of derived-type items. It
takes the following form:
cDEC$ PACK:[{1 | 2 | 4}]
c Is one of the following: C (or c), !, or *.
Items of derived types and record structures are aligned in memory
on the smaller of two sizes: the size of the type of the item, or
the current alignment setting. The current alignment setting can
be 1, 2, 4, or 8 bytes. The default initial setting is 8 bytes
(unless a compiler option specifies otherwise). By reducing the
alignment setting, you can pack variables closer together in
memory.
The PACK directive lets you control the packing of derived-type or
record structure items inside your program by overriding the
current memory alignment setting.
For example, if CDEC$ PACK:1 is specified, all variables begin at
the next available byte, whether odd or even. Although this
slightly increases access time, no memory space is wasted. If
CDEC$ PACK:4 is specified, INTEGER(1), LOGICAL(1), and all
character variables begin at the next available byte, whether odd
or even. INTEGER(2) and LOGICAL(2) begin on the next even byte;
all other variables begin on 4-byte boundaries.
If the PACK directive is specified without a number, packing
reverts to the compiler option setting (if any), or the default
setting of 8.
The directive can appear anywhere in a program before the
derived-type definition or record structure definition. It cannot
appear inside a derived-type or record structure definition.
For compatibility, !MS$PACK can be used in place of cDEC$ PACK.
Examples:
Consider the following:
! Use 4-byte packing for this derived type
! Note PACK is used outside of the derived-type definition
!DEC$ PACK:4
TYPE pair
INTEGER a, b
END TYPE
! revert to default or compiler option
!DEC$ PACK: