Instances of a structured type
hold more than one value. Structured types include sets, arrays, records,
and files as well as class, class-reference, and interface
types. Except for sets, which hold ordinal values only, structured types can
contain other structured types; a type can have unlimited levels of
structuring.
By default, the values in a
structured type are aligned on word or double-word boundaries for faster
access. When you declare a structured type, you can include the reserved word packed
to implement compressed data storage. For example,
type
TNumbers = packed array[1..100] of Real;
Using packed slows data access and, in the case of a character array, affects type compatibility. For more information, see Memory management.
Data types and variables: Overview
结构类型的实例可以保存多个值。结构类型包括集合、数组、记录、文件、类、类引用、接口等类型。除集合类型仅保存序数值外,结构类型可以包含任何其他结构类型;一个结构类型可以有无限层的构造(严格来说,嵌套层数仅与可用内存有关)。
默认情况下,结构类型中的值以字(word)或双字(double-word)为界排列时具有更块的访问速度。声明结构类型时,可以包含一个保留字packed,用于实现压缩数据存储。例如,
type
TNumbers = packed array[1..100] of Real;
使用保留字packed将降低数据访问效率,并且,对于字符数组将影响类型兼容性。更多信息见内存管理。