Version 1.2 of ais/ai-00062.txt

Unformatted version of ais/ai-00062.txt version 1.2
Other versions for file ais/ai-00062.txt

!standard 03.04 (31)          99-07-20 AI95-00062/04
!class binding interpretation 95-07-06
!status Corrigendum 2000 99-07-20
!status WG9 approved 95-06-14
!status ARG approved 9-0-1 95-11-01
!status received 95-07-06
!subject Derived access types share the same pool
!summary
A derived access type shares its parent's storage pool.
!question
NOTE 3.4(31) says, "If the parent type is an access type, then the parent and the derived type share the same storage pool..." This is clearly what we want, but I can't seem to prove it from the real rules (i.e. non-NOTES).
!recommendation
A derived access type shares its parent's storage pool.
!wording
!discussion
NOTE 3.4(31) makes the intent clear.
Furthermore, 13.11.2(16) says, "The execution of a call to an instance of Unchecked_Deallocation is erroneous if the object was created other than by an allocator for an access type whose pool is Name'Storage_Pool."
Thus, if a derived access type does not have the same pool as its parent, then the following would be erroneous:
type Parent is access Integer; type Derived is new Parent; X: Derived := new Integer; Y: Parent := Parent(X); procedure Free is new Unchecked_Deallocation(Object => Integer, Name => Parent); ... Free(Y);
The above was not erroneous in Ada 83. This would be a serious upward incompatibility, which there was no intention to introduce.
Note that no such upward incompatibility is documented in the AARM.
!corrigendum 3.10(7)
Replace the paragraph:
There are two kinds of access types, access-to-object types, whose values designate objects, and access-to-subprogram types, whose values designate subprograms. Associated with an access-to-object type is a storage pool; several access types may share the same storage pool. A storage pool is an area of storage used to hold dynamically allocated objects (called pool elements) created by allocators; storage pools are described further in 13.11, "Storage Management".
by:
There are two kinds of access types, access-to-object types, whose values designate objects, and access-to-subprogram types, whose values designate subprograms. Associated with an access-to-object type is a storage pool; several access types may share the same storage pool. A derived access type shares the storage pool of its parent type. A storage pool is an area of storage used to hold dynamically allocated objects (called pool elements) created by allocators; storage pools are described further in 13.11, "Storage Management".
!ACATS test
Create a C-Test that checks that an item of the derived type can be allocated, converted to the parent type, and deallocated. Check that an item of the parent type can be allocated, converted to the derived type, and deallocated.
!appendix

!section 3.4(31)
!subject Derived access types should share the same pool
!reference RM95-3.4(31);6.0
!from Bob Duff
!reference as: 95-5173.a Robert A Duff 95-6-26>>
!discussion

NOTE 3.4(31) says, "If the parent type is an access type, then the
parent and the derived type share the same storage pool..."
This is clearly what we want, but I can't seem to prove it from
the real rules (i.e. non-NOTES).

- Bob

****************************************************************

Questions? Ask the ACAA Technical Agent