From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!212.27.60.64.MISMATCH!cleanfeed3-b.proxad.net!nnrp5-1.free.fr!not-for-mail From: Thomas Newsgroups: comp.lang.ada Mail-Copies-To: nobody Subject: Re: Unchecked_Deallocation with tagged types References: <607b56f8$0$3721$426a34cc@news.free.fr> <07863309-4541-4497-8cec-d88179e634bdn@googlegroups.com> <3d6e49b6-f195-4dc2-bf4b-795f18f2da9dn@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Date: Sat, 16 Apr 2022 07:00:57 +0200 Message-ID: <625a4d8a$0$24798$426a34cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 16 Apr 2022 07:00:58 CEST NNTP-Posting-Host: 91.175.52.121 X-Trace: 1650085258 news-4.free.fr 24798 91.175.52.121:1646 X-Complaints-To: abuse@proxad.net Xref: reader02.eternal-september.org comp.lang.ada:63745 List-Id: In article , Gautier write-only address wrote: > > Well, P'Free can also be in another package... Of course, we are talking > > here only about the direct, actual deallocation. > > > > If you want to precisely know where deallocation is used, use AdaControl > > (for any solution). If you want to be confident that there is no direct > > deallocation in a module, the generic wins. > > It loses because you can have direct, immediate deallocation without the > "with Ada.Unchecked_Deallocation" somewhere in the context clause. > > pack.ads: > > with Ada.Unchecked_Deallocation; > package Pack is > type IA is access Integer; > procedure Release is new Ada.Unchecked_Deallocation (Integer, IA); > end; > > ---- > proc.adb: > > with Pack; > procedure Proc is > use Pack; > P : IA; > begin > P := new Integer; > Release (P); > end; what J-P. Rosen meant was that P'Free could be in the body of Pack.Release, and then it would not be in Proc either. perso i like the design with the "generic". (I'm used to it anyway, although of course it's worse than not needing explicit Deallocation.) but the question is: why in the specification ??? actually i need to know more about your case: - do you find it ok to put the access types in the package specification, and then not have control over what they become? - or don't you want that, but you regularly become in situations where you have no choice (for example because you need components of which you are not the author)? what's your opinion about String_Access and Free in Ada.Strings.Unbounded? I don't understand what they are doing here, since this package is made to avoid needing them... -- RAPID maintainer http://savannah.nongnu.org/projects/rapid/