From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,64ced24a7e89252e,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Unchecked deallocation question Date: Wed, 24 Nov 2004 16:38:39 +0100 Message-ID: <41A4AAFF.5060407@mailinator.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de L2OZjqmNzMarU72eEYAdbwBHNoGMDCf1ub7BJ4ST0aJ4UWxP4= User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en Xref: g2news1.google.com comp.lang.ada:6422 Date: 2004-11-24T16:38:39+01:00 List-Id: I'm wondering if this is correct: type Root is tagged record ... type Root_Access is access Root; type Derived is new Root with ... type Derived_Access is access Derived; procedure Free is new Ada.Unchecked_Deallocation (Root'Class, Root_Access); declare It : Derived_Access := new Derived; begin Free (Root_Access (It)); -- <-- THIS DEALLOCATION I'M ASKING end; Assuming that all involved access types use the same Storage_Pool. The purpose is to have a single deallocator in the root package and to not have to instantiate a lot of deallocators for derived types.