Quick start manual
Memory management
11-3
Internal data formats
Internal data formats
The following sections describe the internal formats of Delphi data types.
Integer types
The format of an integer-type variable depends on its minimum and maximum
bounds.
• If both bounds are within the range –128..127 (Shortint), the variable is stored as a
signed byte.
• If both bounds are within the range 0..255 (Byte), the variable is stored as an
unsigned byte.
• If both bounds are within the range –32768..32767 (Smallint), the variable is stored
as a signed word.
• If both bounds are within the range 0..65535 (Word), the variable is stored as an
unsigned word.
• If both bounds are within the range –2147483648..2147483647 (Longint), the
variable is stored as a signed double word.
• If both bounds are within the range 0..4294967295 (Longword), the variable is
stored as an unsigned double word.
• Otherwise, the variable is stored as a signed quadruple word (Int64).
Character types
A Char, an AnsiChar, or a subrange of a Char type is stored as an unsigned byte. A
WideChar is stored as an unsigned word.
Boolean types
A Boolean type is stored as a Byte, a ByteBool is stored as a Byte, a WordBool type is
stored as a Word, and a LongBool is stored as a Longint.
A Boolean can assume the values 0 (False) and 1 (True). ByteBool, WordBool, and
LongBool types can assume the values 0 (False) or nonzero (True).
Enumerated types
An enumerated type is stored as an unsigned byte if the enumeration has no more
than 256 values and the type was declared in the {$Z1} state (the default). If an
enumerated type has more than 256 values, or if the type was declared in the {$Z2}
state, it is stored as an unsigned word. If an enumerated type is declared in the {$Z4}
state, it is stored as an unsigned double-word.