comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: What's wrong with this code?
Date: 1999/04/20
Date: 1999-04-20T00:00:00+00:00	[thread overview]
Message-ID: <m33e1v1739.fsf@mheaney.ni.net> (raw)
In-Reply-To: 7fiegr$43q$1@nnrp1.dejanews.com

dennison@telepath.com writes:

> In article <7fi85m$sb3$1@nnrp1.dejanews.com>,
>   okellogg@my-dejanews.com wrote:
> > Dear colleagues:
> >
> > I can't find what wrong with this code (see full declaration of type 
> > Alarm.) Perhaps someone would like to comment?
> >
> >     type Alarm is tagged limited
> >         record
> >             -- This compiles alright:
> >             Semaphore : Alarm_Semaphore (Alarm'Access);
> >
> >             -- But here, GNAT 3.11p says:
> >             --  "Access" attribute cannot be applied to type
> >             Alarm_State_Pool : Alarm_State_Pool_At :=
> >                (Snafu => new Snafu_State (Alarm'Access),
> >                 Data => new Data_State (Alarm'Access),
> >                 Proposal => new Proposal_State (Alarm'Access));
> >
> >         end record;
> >
> > end Alarm_Model;
> 
> That's probably because 'Access can't be applied to a type. :-)

This statement is incorrect.

Inside the declaration of the Alarm type, Alarm'Access denotes the
"current instance" the type.  

 
> What is it you are trying to accomplish with Alarm'Access? Surely you
> don't want a pointer into the compiler's type table for "Alarm", which
> is about the only thing this could mean. Perhaps you are hoping to
> automaticly get a pointer to the *object* in question when you create
> objects of this type?

Yes.





  reply	other threads:[~1999-04-20  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-20  0:00 What's wrong with this code? okellogg
1999-04-20  0:00 ` dennison
1999-04-20  0:00   ` Matthew Heaney [this message]
1999-04-20  0:00   ` dennison
1999-04-20  0:00     ` Matthew Heaney
1999-04-21  0:00       ` dennison
1999-04-21  0:00 ` Stephen Leake
replies disabled

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