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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,de1c23707584fc3c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-22 14:23:34 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!newsfeed.mathworks.com.MISMATCH!newsfeed!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: virtual destructors Date: 22 Apr 2003 17:23:33 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1051046613 8824 199.172.62.241 (22 Apr 2003 21:23:33 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 22 Apr 2003 21:23:33 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:36374 Date: 2003-04-22T17:23:33-04:00 List-Id: Stephen Leake 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