Version 1.1 of ais/ai-00062.txt

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

!standard 03.04 (31)          96-07-23 AI95-00062/03
!class binding interpretation 95-07-06
!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 95-07-06
A derived access type shares its parent's storage pool.
!question 95-07-06
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 95-07-06
A derived access type shares its parent's storage pool.
!wording 95-07-06
!discussion 96-07-23
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.
!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