Contents   Index   Previous   Next


13.5.2 Storage Place Attributes

Static Semantics

1
   {storage place attributes (of a component)} For a component C of a composite, non-array object R, the storage place attributes are defined:
1.a
Ramification: The storage place attributes are not (individually) specifiable, but the user may control their values by giving a record_representation_clause.
2
   R.C'Position
Denotes the same value as R.C'Address - R'Address. The value of this attribute is of the type universal_integer.
2.a
Ramification: Thus, R.C'Position is the offset of C in storage elements from the beginning of the object, where the first storage element of an object is numbered zero. R'Address + R.C'Position = R.C'Address. For record extensions, the offset is not measured from the beginning of the extension part, but from the beginning of the whole object, as usual.
2.b
In ``R.C'Address - R'Address'', the "-" operator is the one in System.Storage_Elements that takes two Addresses and returns a Storage_Offset.
3
   R.C'First_Bit
Denotes the offset, from the start of the first of the storage elements occupied by C, of the first bit occupied by C. This offset is measured in bits. The first bit of a storage element is numbered zero. The value of this attribute is of the type universal_integer.
4
   R.C'Last_Bit
Denotes the offset, from the start of the first of the storage elements occupied by C, of the last bit occupied by C. This offset is measured in bits. The value of this attribute is of the type universal_integer.
4.a
Ramification: The ordering of bits in a storage element is is defined in 13.5.3, ``Bit Ordering''.
4.b
R.C'Size = R.C'Last_Bit - R.C'First_Bit + 1. (Unless the implementation chooses an indirection representation.)
4.c
If a component_clause applies to a component, then that component will be at the same relative storage place in all objects of the type. Otherwise, there is no such requirement.

Implementation Advice

5
   {contiguous representation [partial]} {discontiguous representation [partial]} If a component is represented using some form of pointer (such as an offset) to the actual data of the component, and this data is contiguous with the rest of the object, then the storage place attributes should reflect the place of the actual data, not the pointer. If a component is allocated discontiguously from the rest of the object, then a warning should be generated upon reference to one of its storage place attributes.
5.a
Reason: For discontiguous components, these attributes make no sense. For example, an implementation might allocate dynamic-sized components on the heap. For another example, an implementation might allocate the discriminants separately from the other components, so that multiple objects of the same subtype can share discriminants. Such representations cannot happen if there is a component_clause for that component.

Contents   Index   Previous   Next   Legal