Node: Record Representation Clauses, Next: Enumeration Clauses, Previous: Pragma Pack for Records, Up: Representation Clauses and Pragmas
Record representation clauses may be given for all record types, including types obtained by record extension. Component clauses are allowed for any static component. The restrictions on component clauses depend on the type of the component.
For all components of an elementary type, the only restriction on component clauses is that the size must be at least the 'Size value of the type (actually the Value_Size). There are no restrictions due to alignment, and such components may freely cross storage boundaries.
Packed arrays with a size up to and including 64-bits are represented internally using a modular type with the appropriate number of bits, and thus the same lack of restriction applies. For example, if you declare:
type R is array (1 .. 49) of Boolean; pragma Pack (R); for R'Size use 49;
then a component clause for a component of type R may start on any specified bit boundary, and may specify a value of 49 bits or greater.
For non-primitive types, including packed arrays with a size greater than 64-bits, component clauses must respect the alignment requirement of the type, in particular, always starting on a byte boundary, and the length must be a multiple of the storage unit.
The tag field of a tagged type always occupies an address sized field at the start of the record. No component clause may attempt to overlay this tag.
In the case of a record extension T1, of a type T, no component clause applied to the type T1 can specify a storage location that would overlap the first T'Size bytes of the record.