``obj'Bit``, where ``obj`` is any object, yields the bit
offset within the storage unit (byte) that contains the first bit of
storage allocated for the object. The value of this attribute is of the
-type *universal_integer*, and is always a non-negative number not
-exceeding the value of ``System.Storage_Unit``.
+type *universal_integer* and is always a nonnegative number smaller
+than ``System.Storage_Unit``.
For an object that is a variable or a constant allocated in a register,
the value is zero. (The use of this attribute does not force the
.. code-block:: ada
- type Unconstr_Array is array (Positive range <>) of Boolean;
+ type Unconstr_Array is array (Short_Short_Integer range <>) of Positive;
Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
-The attribute takes into account any additional padding due to type alignment.
-In the example above, the descriptor contains two values of type
-``Positive`` representing the low and high bound. Since ``Positive`` has
-a size of 31 bits and an alignment of 4, the descriptor size is ``2 * Positive'Size + 2`` or 64 bits.
+The attribute takes into account any padding due to the alignment of the
+component type. In the example above, the descriptor contains two values
+of type ``Short_Short_Integer`` representing the low and high bound. But,
+since ``Positive`` has an alignment of 4, the size of the descriptor is
+``2 * Short_Short_Integer'Size`` rounded up to the next multiple of 32,
+which yields a size of 32 bits, i.e. including 16 bits of padding.
Attribute Elaborated
====================
@copying
@quotation
-GNAT Reference Manual , May 13, 2020
+GNAT Reference Manual , May 14, 2020
AdaCore
@code{obj'Bit}, where @code{obj} is any object, yields the bit
offset within the storage unit (byte) that contains the first bit of
storage allocated for the object. The value of this attribute is of the
-type @emph{universal_integer}, and is always a non-negative number not
-exceeding the value of @code{System.Storage_Unit}.
+type @emph{universal_integer} and is always a nonnegative number smaller
+than @code{System.Storage_Unit}.
For an object that is a variable or a constant allocated in a register,
the value is zero. (The use of this attribute does not force the
the first element of the array.
@example
-type Unconstr_Array is array (Positive range <>) of Boolean;
+type Unconstr_Array is array (Short_Short_Integer range <>) of Positive;
Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
@end example
-The attribute takes into account any additional padding due to type alignment.
-In the example above, the descriptor contains two values of type
-@code{Positive} representing the low and high bound. Since @code{Positive} has
-a size of 31 bits and an alignment of 4, the descriptor size is @code{2 * Positive'Size + 2} or 64 bits.
+The attribute takes into account any padding due to the alignment of the
+component type. In the example above, the descriptor contains two values
+of type @code{Short_Short_Integer} representing the low and high bound. But,
+since @code{Positive} has an alignment of 4, the size of the descriptor is
+@code{2 * Short_Short_Integer'Size} rounded up to the next multiple of 32,
+which yields a size of 32 bits, i.e. including 16 bits of padding.
@node Attribute Elaborated,Attribute Elab_Body,Attribute Descriptor_Size,Implementation Defined Attributes
@anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{174}