8.2.4 Enumeration types

By default all enumerations are stored as a longword (4 bytes), which is equivalent to specifying the {$Z4}, {$PACKENUM 4} or {$PACKENUM DEFAULT} switches.

This default behavior can be changed by compiler switches, and by the compiler mode.

In the tp compiler mode, or while the {$Z1} or {$PACKENUM 1} switches are in effect, the storage space used is shown in table (8.1).


Table 8.1: Enumeration storage for tp mode

# Of Elements in Enum.Storage space used


0..255 byte (1 byte)
256..65535 word (2 bytes)
65535 longword (4 bytes)



When the {$Z2} or {$PACKENUM 2} switches are in effect, the value is stored in 2 bytes (a word), if the enumeration has less or equal than 65535 elements. If there are more elements, the enumeration value is stored as a 4 byte value (a longword).