comp.lang.ada
 help / color / mirror / Atom feed
From: "Alex R. Mosteo" <devnull@mailinator.com>
Subject: Re: generic question
Date: Tue, 21 Nov 2006 09:25:17 +0100
Date: 2006-11-21T09:25:17+01:00	[thread overview]
Message-ID: <4sfrbnFv4ibiU1@mid.individual.net> (raw)
In-Reply-To: 4562a51a$0$27404$ba4acef3@news.orange.fr

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...



  reply	other threads:[~2006-11-21  8:25 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-19 18:03 generic question markww
2006-11-19 19:17 ` Ludovic Brenta
2006-11-19 19:23   ` Stefan Bellon
2006-11-19 20:16     ` markww
2006-11-19 22:07     ` Pascal Obry
2006-11-20 10:35       ` Alex R. Mosteo
2006-11-20 17:03         ` Pascal Obry
2006-11-20 18:10           ` Alex R. Mosteo
2006-11-20 21:16             ` markww
2006-11-20 21:40               ` Matthew Heaney
2006-11-20 21:50       ` Matthew Heaney
2006-11-21  7:04         ` Pascal Obry
2006-11-21  8:25           ` Alex R. Mosteo [this message]
2006-11-21 14:25             ` Matthew Heaney
2006-11-21 15:47               ` Matthew Heaney
2006-11-21 17:14                 ` Pascal Obry
2006-11-21 18:15                   ` Matthew Heaney
2006-11-21 18:28                     ` Dmitry A. Kazakov
2006-11-21 14:21           ` Matthew Heaney
2006-11-21 17:12             ` Pascal Obry
2006-11-21 17:25               ` Lutz Donnerhacke
2006-11-21 17:35                 ` Alex R. Mosteo
2006-11-21 18:18                 ` Matthew Heaney
2006-11-22 23:58                 ` Randy Brukardt
2006-11-23  8:32                   ` Dmitry A. Kazakov
2006-11-28 21:23                     ` Randy Brukardt
2006-11-29 15:57                       ` Matthew Heaney
2006-11-21 18:14               ` Matthew Heaney
2006-11-23  0:02                 ` Randy Brukardt
2006-11-21 18:17               ` Dmitry A. Kazakov
2006-11-21 18:32                 ` Matthew Heaney
2006-11-19 20:24 ` Jeffrey R. Carter
2006-11-19 20:33   ` markww
2006-11-20 17:31 ` Adam Beneschan
2006-11-21 16:22 ` Matthew Heaney
  -- strict thread matches above, loose matches on Subject: below --
2003-11-23 20:59 shoko
2003-11-23 21:41 ` Marius Amado Alves
replies disabled

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