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 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: Unchecked deallocation question Date: Thu, 25 Nov 2004 10:12:14 +0100 Message-ID: <41A5A1EE.5060607@mailinator.com> References: <41A4AAFF.5060407@mailinator.com> <4540106.PdnsrBBvo5@linux1.krischik.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 Ks3qX3T7bpG0Mj65k6YGyQ2OldfpEeVg7V+4yRHzm44UKau7Q= User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en In-Reply-To: <4540106.PdnsrBBvo5@linux1.krischik.com> Xref: g2news1.google.com comp.lang.ada:6454 Date: 2004-11-25T10:12:14+01:00 List-Id: Martin Krischik wrote: > Alex R. Mosteo wrote: > > >>declare >> It : Derived_Access := new Derived; >>begin >> Free (Root_Access (It)); -- <-- THIS DEALLOCATION I'M ASKING >>end; > > > You should carefully thing if you really need it. Unlike C/C++ the following > is actually valid: > > declare > It : Root'Class := Derived'(...); > begin > ... > end; > > It is more or less the same concept as: > > declare > It : String := "Hello World!"; > begin > ... > end; > > 3 Month into learning Ada I began to fully understand what an "indefinte > type" is and what it can do fro you - and then I remove more then 80% of > all my access types. Ok, I see I've worded my question poorly indeed. I know these concepts and my example code was just a quick improvisation. I was just concerned about the feasibility of using a 'Class deallocator to deallocate an entire polimorphic list, for example. In any case, it was a doubt that arised in a bad moment of mind, because I've indeed done that several times. There was some oddity in what was coding that threw me off-track for some time. Thanks for your responses, A.