From: "Alex R. Mosteo" <devnull@mailinator.com>
Subject: Re: Unchecked deallocation question
Date: Thu, 25 Nov 2004 10:12:14 +0100
Date: 2004-11-25T10:12:14+01:00 [thread overview]
Message-ID: <41A5A1EE.5060607@mailinator.com> (raw)
In-Reply-To: <4540106.PdnsrBBvo5@linux1.krischik.com>
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.
next prev parent reply other threads:[~2004-11-25 9:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-24 15:38 Unchecked deallocation question Alex R. Mosteo
2004-11-24 17:24 ` Jeffrey Carter
2004-11-24 17:35 ` Alex R. Mosteo
2004-11-24 17:33 ` David Botton
2004-11-25 8:35 ` Martin Krischik
2004-11-25 9:12 ` Alex R. Mosteo [this message]
2004-11-25 23:24 ` Adrien Plisson
2004-11-26 4:05 ` Jim Rogers
2004-11-26 10:53 ` Sergey
2004-11-26 9:06 ` Dmitry A. Kazakov
2004-11-26 18:20 ` Sergey
2004-11-27 8:43 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox