CVS difference for ais/ai-00319.txt

Differences between 1.4 and version 1.5
Log of other versions for file ais/ai-00319.txt

--- ais/ai-00319.txt	2003/03/04 04:56:23	1.4
+++ ais/ai-00319.txt	2003/09/25 01:49:13	1.5
@@ -1,4 +1,4 @@
-!standard 13.03 (58)                                 02-10-09  AI95-00319/01
+!standard 13.03 (58)                                 03-09-19  AI95-00319/02
 !class amendment 02-10-09
 !status No Action (6-1-1) 03-02-08
 !status work item 02-10-09
@@ -13,8 +13,36 @@
 
 !problem
 
-(* TBD. *)
+The 'Size attribute for a (sub)type only gives a lower bound on the size of
+objects and components of the type. For aliased objects and components, the
+size of the object or component is usually larger than the default value of
+'Size. Moreover, even when specified, there is no guarantee that the size
+specified will actually be used for objects. (And 'Size can only be specified
+for first subtypes, for other subtypes, the compiler is free to do whatever
+it likes.)
+
+This can be a problem when positioning components. It is not possible, in
+general, to write a truly portable representation clause for a record with
+aliased components:
+
+    type Test_Rec is record
+        A : aliased Natural;
+        B : Boolean;
+    end record;
+    for Test_Rec use record
+        A at 0 range 0 .. Natural'Size-1; -- Error, wrong size.
+        B at 0 range Natural'Size .. Natural'Size; -- Error, overlapping.
+    end record;
+
+Since 'Size for scalar types represents the size of a value of the type, it
+in general is *not* the size of an object of the type. Thus, specifying the
+size of a (sub)type causes a number of unusual effects (such as the size
+being forgotten for some derviations).
+
+What is needed is a way to specify the default size of an object of a type,
+such as the facility provided in GNAT.
 
+
 !proposal
 
 (See Wording.)
@@ -30,17 +58,14 @@
 For every subtype S:
 
 S'Object_Size	If S is definite, denotes the size (in bits) that the
-implementation would choose for the following objects of subtype S:
-    * A stand-alone object of subtype S.
-    * A record component of subtype S when the record type has
-      no representation items applied.
-    * An array component of subtype S when the array type has
-      no representation items applied.
+implementation would choose for the a stand-alone aliased object of subtype S.
 If S is indefinite, the meaning is implementation-defined. The value of this
 attribute is of the type universal_integer. The Object_Size of a subtype is at
 least as large as the Size of the subtype. Object_Size may be specified via
 an attribute_definition_clause; the expression of such a clause shall be static
-and its value nonnegative.
+and its value nonnegative. If Object_Size is specified, all aliased objects
+of the subtype shall have the specified Size.
+
 
 Implementation Advice
 
@@ -67,7 +92,7 @@
     to provide alignment) are not required to do any rounding up.
 
 If X denotes an object (including components) of subtype S, X'Size should
-be S'Object_Size, unless:
+equal S'Object_Size, unless:
     X'Size is specified; or
     The size of X is determined by a component_clause or Component_Size clause; or
     Pragma Pack applies to the type containing component X.
@@ -214,8 +239,7 @@
    -- I might as well find out if its the right approach before trying to
       justify it.
 
-No one here probably remembers the September 1999 discussion on this
-attribute,
+No one here probably remembers the September 1999 discussion on this attribute,
 so I figure I'm pretty safe even if I missed it by a mile. :-)
 
 So, go ahead and take some potshots. :-)

Questions? Ask the ACAA Technical Agent