comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Q:Usage of storage Pools
Date: 31 May 2003 16:23:20 -0400
Date: 2003-05-31T16:23:20-04:00	[thread overview]
Message-ID: <wcc7k86c1c7.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: jcamq-v1p.ln1@boavista.snafu.de

Michael Erdmann <michael.erdmann@snafu.de> writes:

> Hallo all,
> 
> i am trying to use storage pools, and i have come to a blocking 
> point. The construct below failes to compile with GNAT:
> 
> with Pool;
> 
> package List is
> 
>    type List_Element_Type;
>    type List_Element_Access is access List_Element_Type;
> 
>    type List_Element_Type is record
>           Next : List_Element_Access := null;
>        end record;
> 
>    package Element_Pool is new Pool( Pool_Data_Type => List_Element_Type );
> 
>    Storage : Element_Pool.Object;
>    for List_Element_Access'Storage_Pool use Storage;
> 
> end List;
> 
> with the error 
> 
> gnatmake test.adb -o testx
> gcc -c test.adb
> list.ads:12:04: warning: no more representation items for type 
> "List_Element_Access" defined at line 6
> list.ads:15:04: representation item appears too late
> gnatmake: "test.adb" compilation error
> 
> I have played arround with various locations of the for statement
> but is does not help.

You can't put the "for..." after a generic instantiation.
You can't put it before the instantiation, since it refers
to the instance.

Why do you want to pass the type into the pool generic like that?
To know its size and alignment?

You might be able to pass this info to the pool as discriminants,
instead.

- Bob



       reply	other threads:[~2003-05-31 20:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <jcamq-v1p.ln1@boavista.snafu.de>
2003-05-31 20:23 ` Robert A Duff [this message]
2003-05-31 20:50   ` Q:Usage of storage Pools Michael Erdmann
2003-05-31 23:55     ` Robert A Duff
2003-06-01  6:55       ` Michael Erdmann
2003-06-01  8:05         ` Simon Wright
2003-06-02 19:28           ` Michael Erdmann
replies disabled

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