comp.lang.ada
 help / color / mirror / Atom feed
From: "Arthur Schwarz" <aschwarz1309@worldnet.att.net>
Subject: Ptr Problem Question
Date: Fri, 01 Oct 2004 10:46:26 GMT
Date: 2004-10-01T10:46:26+00:00	[thread overview]
Message-ID: <6Aa7d.465487$OB3.325741@bgtnsc05-news.ops.worldnet.att.net> (raw)
In-Reply-To: d05d2155.0410010229.3e1ae70c@posting.google.com

Each Ptr assignment below yields the following error message:

--    9.    Ptr     : a.X_Ptr  := Object'Access;
--       >>> non-local pointer cannot point to local object

In the past, the only way that I seem to be able to fix the problem is to
put the pointer and assignment in global space (either in file global or in
a package spec). I've looked at Ada as a Second Language (Cohen) and, with
less diligence, at the Ada LRM but can't figure what I'm doing wrong. What
am I doing wrong?

art

-----------------------------------------------------------
-----------------------------------------------------------

package a is
   type X     is new Integer;
   type X_Ptr is access all X;
end a;

--------------------------------------------------------

with a;

Procedure b is
   subtype Y         is a.X;
   subtype Y_Ptr     is a.X_Ptr;

   Object  : aliased a.X;
   Object_Y: aliased Y;
   Ptr     : a.X_Ptr  := Object'Access;
   Ptr_Y   : Y_Ptr    := Object'Access;
   Ptr_OY  : a.X_Ptr  := Object'Access;
   Ptr_1Y  : Y_Ptr    := Object'Access;

begin -- b
   Ptr     := Object'Access;
   Ptr_Y   := Object'Access;
end b;





  parent reply	other threads:[~2004-10-01 10:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-01 10:29 gnat 3.15p with kernel 2.6 / SuSE 9.1 Thomas Aho
2004-10-01 10:40 ` Florian Weimer
2004-10-01 13:24   ` Marc A. Criley
2004-10-01 17:15     ` Ludovic Brenta
2004-10-04  8:36       ` Alex R. Mosteo
2004-10-05  6:35         ` Thomas Aho
2004-10-01 10:46 ` Arthur Schwarz [this message]
2004-10-01 11:04   ` Ptr Problem Question Marius Amado Alves
2004-10-01 18:12   ` Jeffrey Carter
replies disabled

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