comp.lang.ada
 help / color / mirror / Atom feed
From: dennison@telepath.com
Subject: Re: What's wrong with this code?
Date: 1999/04/21
Date: 1999-04-21T00:00:00+00:00	[thread overview]
Message-ID: <7fkpe7$5is$1@nnrp1.dejanews.com> (raw)
In-Reply-To: m3zp43ywi8.fsf@mheaney.ni.net

In article <m3zp43ywi8.fsf@mheaney.ni.net>,
  Matthew Heaney <matthew_heaney@acm.org> wrote:
> dennison@telepath.com writes:
>
> > I tried adding the following declarations:
> >     type Alarm_List is array (1..2) of Alarm_P;
> >
> >     type Alarm is tagged limited
> >     ...
> >             Al : Alarm_List := (others => Alarm'Access);
> >
> > And got this error (on the "Al" field) instead:
> > alarm_model.ads:52:43: non-local pointer cannot point to local object
>
> What message do you get if you use 'Unchecked_Access instead of 'Access?


Just the same old ""Access" attribute cann be applied to type". Good call.

I tried compiling the same code (the original code, not my modified
version) using my GreenHills (Intermetrics-based) compiler, and got:

d:\test\tmp\alarm_model.ads: Error: line 53 col 26 LRM:3.10.2(28), The
accessibility level of the prefix to 'ACCESS shall not be statically deeper
than that of the expected type of the allocator, Continuing

on the same line I got the above Gnat error. Changing the three "'Access"es to
"'Unchecked_Access" caused the GrennHills compile to succeed. But in Gnat the
same code gave me

alarm_model.ads:53:43: "Unchecked_Access" attribute cannot be applied to type
alarm_model.ads:54:41: "Unchecked_Access" attribute cannot be applied to type
alarm_model.ads:55:49: "Unchecked_Access" attribute cannot be applied to type


So it looks like one compiler (gnat) thinks the whole construct is illegal,
while the other (GreenHills) thinks the only problem is accessability levels.

--
T.E.D.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1999-04-21  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   ` dennison
1999-04-20  0:00     ` Matthew Heaney
1999-04-21  0:00       ` dennison [this message]
1999-04-20  0:00   ` Matthew Heaney
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