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,edd7ea1b2d7e9a18 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-14 00:29:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.ems.psu.edu!news.litech.org!news-feed.riddles.org.uk!news-peer.gradwell.net!not-for-mail MIME-Version: 1.0 X-Newsreader: knews 1.0b.1 References: From: porton@ex-code.com (Victor Porton) Subject: Re: Pitfall: freeing access discriminants Newsgroups: comp.lang.ada Content-Type: text/plain; charset=us-ascii Message-ID: Date: Fri, 14 Feb 2003 13:28:40 +0500 Organization: Extreme Code Software (http://ex-code.com) X-URL: http://www.ex-code.com/ NNTP-Posting-Date: 14 Feb 2003 08:29:01 GMT NNTP-Posting-Host: 195.149.39.13 X-Trace: 1045211341 news.gradwell.net 346 mail2news/195.149.39.13 X-Complaints-To: news-abuse@gradwell.net Xref: archiver1.google.com comp.lang.ada:34092 Date: 2003-02-14T08:29:01+00:00 List-Id: In article , tmoran@acm.org writes: > In this case, you can shoot safely away from your foot with > Christoph Grein's suggested: >> procedure Finalize (Object: in out T) is >> type Integer_Ptr is access all Integer; >> procedure Free is new Ada.Unchecked_Deallocation (Integer, Integer_Ptr); >> P: Integer_Ptr := Integer_Ptr (Object.D); >> begin >> Free (P); >> end Finalize; > > I seems to me that you needn't worry that >> Because of storage pools for Integer_Ptr may be different >> from storage pool used by "new". > because you get a standard storage pool unless you specify otherwise, so >> type T(D: access Integer) >> type Integer_Ptr is access all Integer; > should both refer to the same storage pool. In my understanding there may be several standard access pool and the pool for access Integer and for Integer_Ptr may be different. Isn't it so?