comp.lang.ada
 help / color / mirror / Atom feed
From: "Alex R. Mosteo" <devnull@mailinator.com>
Subject: Unchecked deallocation question
Date: Wed, 24 Nov 2004 16:38:39 +0100
Date: 2004-11-24T16:38:39+01:00	[thread overview]
Message-ID: <41A4AAFF.5060407@mailinator.com> (raw)

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.



             reply	other threads:[~2004-11-24 15:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-24 15:38 Alex R. Mosteo [this message]
2004-11-24 17:24 ` Unchecked deallocation question 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
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