Ada Reference Manual (Ada 2022)Legal Information
Contents   Index   References   Search   Previous   Next 

13.2 Packed Types

1/3
The Pack aspect having the value True specifies that storage minimization should be the main criterion when selecting the representation of a composite type. 
Paragraphs 2 through 4 were moved to Annex J, “Obsolescent Features”. 

Static Semantics

5/3
For a full type declaration of a composite type, the following language-defined representation aspect may be specified:
5.1/3
 Pack
The type of aspect Pack is Boolean. When aspect Pack is True for a type, the type (or the extension part) is said to be packed. For a type extension, the parent part is packed as for the parent type, and specifying Pack causes packing only of the extension part.
5.2/3
If directly specified, the aspect_definition shall be a static expression. If not specified (including by inheritance), the aspect is False. 

Implementation Advice

6
If a type is packed, then the implementation should try to minimize storage allocated to objects of the type, possibly at the expense of speed of accessing components, subject to reasonable complexity in addressing calculations. 
6.1/4
 This paragraph was deleted.
7/3
The recommended level of support for the Pack aspect is: 
7.1/4
Any component of a packed type that is of a by-reference type, that is specified as independently addressable, or that contains an aliased part, shall be aligned according to the alignment of its subtype.
8/5
For a packed record type, the components should be packed as tightly as possible subject to the above alignment requirements, the Sizes of the component subtypes, and any record_representation_clause that applies to the type; the implementation is allowed to reorder components or cross aligned word boundaries to improve the packing. A component whose Size is greater than the word size may be allocated an integral number of words.
9/4
For a packed array type, if the Size of the component subtype is less than or equal to the word size, Component_Size should be less than or equal to the Size of the component subtype, rounded up to the nearest factor of the word size, unless this would violate the above alignment requirements.

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe