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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bd1d347880390e54 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-16 21:27:44 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!82-43-33-75.cable.ubr01.croy.blueyonder.co.UK!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Re: Type conversions on pool-specific access types Date: Fri, 17 Oct 2003 05:27:41 +0100 Message-ID: References: <7kukov45dif9p7u2ohu6ml29mu9cgu621o@4ax.com> Reply-To: "Nick Roberts" NNTP-Posting-Host: 82-43-33-75.cable.ubr01.croy.blueyonder.co.uk (82.43.33.75) X-Trace: news.uni-berlin.de 1066364862 26183865 82.43.33.75 (16 [25716]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 x-mimeole: Produced By Microsoft MimeOLE V5.50.4807.1700 Xref: archiver1.google.com comp.lang.ada:1050 Date: 2003-10-17T05:27:41+01:00 List-Id: I think I should add the following note. In the example starting with: > type My_Object; if instead of: > type My_Object_Ptr is access My_Object; I had put: type My_Object_Ptr is access My_Object'Class; and instead of : > procedure Free is new Ada.Unchecked_Deallocation(My_Object,My_Object_Ptr); I had put: procedure Free is new Ada.Unchecked_Deallocation(My_Object'Class,My_Object_Ptr); then within: > procedure Finalize (List: in out My_Object_List) is > Obj, Tmp: My_Object_Ptr; > begin > Obj := List.First; > List.First := null; > while Obj /= null loop > Tmp := Obj; > Obj := Obj.Next; > Free(Tmp); -- will call member's Finalize and its pool's Deallocate > end loop; > end Finalize; the call to Free would within itself make a dispatching call to the appropriate Finalize, according to the actual type of each member object. -- Regards, Nick