From: matthew_heaney@acm.org (Matthew Heaney)
Subject: Re: Self-referential 'Access
Date: 1998/04/20
Date: 1998-04-20T00:00:00+00:00 [thread overview]
Message-ID: <matthew_heaney-ya023680002004980916500001@news.ni.net> (raw)
In-Reply-To: 353B4DC4.EB3650F4@ghg.net
In article <353B4DC4.EB3650F4@ghg.net>, Stanley Allen <sallen@ghg.net> wrote:
(start of quote)
------------ cellar.ads -----------
package Cellar is
type Cell;
type List is access all Cell;
type Cell is limited record
Contents : String (1 .. 10);
Next_Cell : List := Cell'Access; --line 9
Prev_Cell : List := Cell'Access; --line 10
end record;
end Cellar;
-----------------------------------
Both compilers claim that the uses of the
'Access attribute are not valid because they
violate the rules concerning depth of
accessability.
(end of quote)
I don't know the exact rules here, but what I do in cases like this is just
use Unchecked_Access:
type Cell is limited record
Contents : String (1 .. 10);
Next_Cell : List := Cell'Unchecked_Access;
Prev_Cell : List := Cell'Unchecked_Access;
end record;
This compiles cleanly using GNAT 3.10p.
next prev parent reply other threads:[~1998-04-20 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-04-20 0:00 Self-referential 'Access Stanley Allen
1998-04-20 0:00 ` Matthew Heaney [this message]
1998-04-20 0:00 ` Jerry van Dijk
1998-04-20 0:00 ` Tucker Taft
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox