CVS difference for ais/ai-00216.txt

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

--- ais/ai-00216.txt	2001/10/02 01:27:51	1.4
+++ ais/ai-00216.txt	2001/10/09 00:47:09	1.5
@@ -1,4 +1,4 @@
-!standard 03.08.01      (01)                        01-10-01  AI95-00216/04
+!standard 03.08.01      (01)                        01-10-05  AI95-00216/05
 !class amendment 99-03-23
 !status work item 99-03-23
 !status received 99-03-23
@@ -23,10 +23,10 @@
 
     pragma Unchecked_Union(first_subtype_mark);
 
-This pragma is intended for use with a type with a variant part (potentially
-with further nested variant parts), that is to be manipulated in C using
-union(s). The pragma specifies that the associated type should be given a
-representation that leaves no space for the discriminant(s) of the type.
+This representation pragma is intended for use with a type with a variant part
+(potentially with further nested variant parts), that is to be manipulated in C
+using unions.  The pragma specifies that the associated type should be given a
+representation that leaves no space for the discriminants of the type.
 Furthermore, the effect of this pragma includes an implicit suppress of
 Discriminant_Check on the specified type, and an implicit convention of C
 (which may be overridden).
@@ -34,29 +34,29 @@
 The specified type may have a non-variant part preceding the variant part,
 which would correspond to a C struct containing a union as its last component.
 A variant may have multiple components, which would correspond to a C union
-with a struct as one of its elements.  A variant may have a nested variant
-part, which would correspond to a nested C union.  The type may have multiple
+with a struct as one of its elements. A variant may have a nested variant part,
+which would correspond to a nested C union. The type may have multiple
 discriminants, to support the possibly nested unions being selected along
 different dimensions.
 
 The Ada type may, but need not, have defaults for all discriminants. All
 objects of the type, even if limited or allocated in the heap (and hence
-effectively constrained by the initial discriminant value(s)), should be
-allocated the size C would allocate for the corresponding struct/union, which
-will be at least the maximum size required for any discriminant value.  This is
-because any whole-object assignments performed to or from such an object by the
-C code will generally involve this maximum size, even if they preserve the
+effectively constrained by the initial discriminant values), must be allocated
+the size C would allocate for the corresponding struct/union, which will be at
+least the maximum size required for any discriminant value.  This is because
+any whole-object assignments performed to or from such an object by the C code
+will generally involve this maximum size, even if they preserve the
 (conceptual) discriminant value.
 
 Each discriminant of an object of an unchecked_union type must be specified
 (explicitly or implicitly) when the object is created, even though its value is
 not stored, to enable appropriate default initialization of the appropriate
-variant(s), or to determine which fields should appear in a record aggregate.
+variants, or to determine which fields should appear in a record aggregate.
 
 Within the definition of an unchecked_union type, the discriminants may not be
 used in a constraint in a component_definition, unless the type of the
-component is itself an unchecked_union type.  This is to ensure that the size
-of the component does not depend on the value of the discriminant.  Note that
+component is itself an unchecked_union type. This is to ensure that the size
+of the component does not depend on the value of the discriminant. Note that
 the discriminant may be used to govern a discriminant part or as a default
 initial value for a component.
 
@@ -65,7 +65,7 @@
 
 Constrained subtypes of an unchecked_union type are permitted, as this may be
 necessary to properly specify the (initial) discriminant value for a variable
-or subcomponent having the type.  It is erroneous to perform any operation (in
+or subcomponent having the type. It is erroneous to perform any operation (in
 C or Ada) that would have failed a discriminant check had the discriminant been
 present at run-time.
 
@@ -84,17 +84,23 @@
 checked type, and then convert to/from an unchecked type just before and after
 communicating with C code.)
 
-In an instantiation of a generic, so as to avoid contract violations involving
-discriminant references in the body of the generic, if the actual type is an
-unchecked union, then, if the formal type is private, it must not have known
-discriminants, or if the formal type is derived, the specified ancestor type
-must also be an unchecked union.
+A private type is never an unchecked union (even if its full type is).  As
+usual, a derived type inherits the unchecked union representation aspect from
+its parent type. A formal derived type is an unchecked union if its specified
+ancestor is an unchecked union.
+
+If an unchecked union completes a private type or private extension, the
+partial view must not have known discriminants or it must be an unchecked
+union. For contract model reasons, in an instantiation of a generic, if the
+actual type is an unchecked union, the formal type must not have known
+discriminants, or it must be an unchecked union.
 
-To avoid other kinds of generic contract violations, if the type is
+
+To avoid other kinds of generic contract violations, if an unchecked union is
 non-limited, all of the normal operations of a non-limited type exist,
 including assignment, equality, membership, 'Read, 'Write, 'Input, 'Output,
-etc.  Assignment is defined in terms of a block copy on all bits of the
-representation.  The other operations all raise Program_Error, because they
+etc. Assignment is defined in terms of a block copy on all bits of the
+representation. The other operations all raise Program_Error, because they
 generally require reading the value of the discriminant to give a meaningful
 result.
 

Questions? Ask the ACAA Technical Agent