$MinEnumSize Compiler Directive
{$Z1} // default {$MinEnumSize 1} // default {$Z2} {$Z4} {$MinEnumSize 2} {$MinEnumSize 4} {$Z-} // obsolete, means {$Z1} {$Z+} // obsolete, means {$Z4}
The $MinEnumSize
compiler directive sets the smallest
size (in bytes) that Delphi uses for an enumerated type. The default
is 1 byte, which means Delphi uses the size that is most appropriate.
An enumeration with up to 256 literals fits in 1 byte, and an
enumeration with up to 65,568 literals fits into 2 bytes.
If you have an enumerated type that must be compatible with an
enum
in a C or C++ program, you can adjust the
size of the enumerated type for compatibility. Usually, that means
setting the minimum enumeration size to
4.