comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: virtual destructors
Date: 22 Apr 2003 17:23:33 -0400
Date: 2003-04-22T17:23:33-04:00	[thread overview]
Message-ID: <wcck7dmi5uy.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: ubryyb90o.fsf@nasa.gov

Stephen Leake <Stephe.Leake@nasa.gov> writes:

> In general, the compiler can use different storage pools for each
> access type. 

True, but in the following example, there is only one access type:
CBase.  So both the "new" and the "Free" will be referring to the same
storage pool, namely CBase'Storage_Pool, so all is well.

> If you do:
> 
> A : CBase := new Derived'();
> 
> and then later:
> 
> Free (A);
> 
> The compiler might allocation from CDerived_Storage_Pool, and then
> deallocate from CBase_Storage_Pool. Very bad. 

To get in trouble, you have to do a type conversion.

- Bob



  parent reply	other threads:[~2003-04-22 21:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-22 14:18 virtual destructors kat-Zygfryd
2003-04-22 14:27 ` Stephen Leake
2003-04-22 14:56   ` kat-Zygfryd
2003-04-22 15:45     ` kat-Zygfryd
2003-04-22 16:34       ` tmoran
2003-04-22 21:32         ` Robert A Duff
2003-04-22 17:18       ` Stephen Leake
2003-04-22 16:34         ` Simon Wright
2003-04-22 19:57           ` Stephen Leake
2003-04-22 20:19             ` Simon Wright
2003-04-22 21:23             ` Robert A Duff [this message]
2003-04-23 15:16         ` Matthew Heaney
2003-04-22 17:31       ` virtual destructors - doesn't seem to work kat-Zygfryd
2003-04-22 17:32         ` Simon Wright
2003-04-22 17:33     ` virtual destructors Matthew Heaney
2003-04-22 17:28 ` Matthew Heaney
2003-04-22 17:40   ` kat-Zygfryd
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox