Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

13.2 Pragma Pack

1
A pragma Pack specifies that storage minimization should be the main criterion when selecting the representation of a composite type. 

Syntax

2
The form of a pragma Pack is as follows: 
3
  pragma Pack(first_subtype_local_name);

Legality Rules

4
The first_subtype_local_name of a pragma Pack shall denote a composite subtype. 

Static Semantics

5
A pragma Pack specifies the packing aspect of representation; 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 a pragma Pack causes packing only of the extension part. 

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/2
  If a packed type has a component that is not of a by-reference type and has no aliased part, then such a component need not be aligned according to the Alignment of its subtype; in particular it need not be allocated on a storage element boundary. 
7
The recommended level of support for pragma Pack is: 
8
9

Contents   Index   References   Search   Previous   Next 
Ada-Europe Sponsored by Ada-Europe