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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d6c75b0f89a0f085 X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: What's wrong with this code? Date: 1999/04/20 Message-ID: #1/1 X-Deja-AN: 468811001 References: <7fi85m$sb3$1@nnrp1.dejanews.com> <7fiegr$43q$1@nnrp1.dejanews.com> NNTP-Posting-Date: Tue, 20 Apr 1999 11:22:02 PDT Newsgroups: comp.lang.ada Date: 1999-04-20T00:00:00+00:00 List-Id: 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.