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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9ce5fb49dc74582f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: generic question Date: Tue, 21 Nov 2006 09:25:17 +0100 Message-ID: <4sfrbnFv4ibiU1@mid.individual.net> References: <1163959439.299036.129940@e3g2000cwe.googlegroups.com> <87mz6nnt4v.fsf@ludovic-brenta.org> <20061119202320.19149a2f@cube.tz.axivion.com> <4560D5BE.5060508@obry.net> <1164059458.442430.110710@j44g2000cwa.googlegroups.com> <4562a51a$0$27404$ba4acef3@news.orange.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8Bit X-Trace: individual.net WNFrIIgudXSfkZ0JJm4QiA0ovIhDjB4SkZ5/sKhKBr/HhyTF0= User-Agent: KNode/0.10.4 Xref: g2news2.google.com comp.lang.ada:7592 Date: 2006-11-21T09:25:17+01:00 List-Id: Pascal Obry wrote: > Matthew Heaney a �crit : >> Storage pools are associated with named access types. (I think it's >> possible to allocate using an anonymous access type, but to me that's >> thoroughly confusing and so I have never attempted to do so.) > > Yes of course: > > C : access Integer; > ... > C := new Integer'(12); > >> With anonymous access types the programmer must maintain the >> association between allocated instance and its pool. You can only >> allocate from a pool, and you must deallocate to the same pool from >> which you allocated, so at some point there needs to be a conversion >> between the anonymous access type and the named access type (with which >> the storage pool is associated). > > I do not follow. The conversion will change nothing: > > 1. you allocate an anonymous access from a "compiler specific pool A" > > 2. you convert the anonymous access type to a named access type : NAT > > 3. you deallocate NAT from a "compiler specific pool B" > > This will allocate and deallocate on different pool. And AFAIK there is > no way to specify the anonymous access type pool. > > I don't see a solution to that problem at the moment... > or I'm confused :) I think Matthew meant (and I certainly did in my other post): type AI is access Integer; function Get_Some return access Integer is Local : constant AI := new Integer'(...); begin return Local; -- Instead of return new Integer'(); end Get_Some; and then you convert back to AI for deallocation. This way you allocate and deallocate from AI'Storage_Pool. I'm not sure about what use cases this can be useful though...