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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,efe381d5ed2da234,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews1.google.com!not-for-mail From: aschwarz@acm.org (skidmarks) Newsgroups: comp.lang.ada Subject: Ada Pointer Problem Date: 1 Oct 2004 08:26:21 -0700 Organization: http://groups.google.com Message-ID: <35f054ea.0410010726.466caebc@posting.google.com> NNTP-Posting-Host: 199.46.200.231 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1096644382 7851 127.0.0.1 (1 Oct 2004 15:26:22 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 1 Oct 2004 15:26:22 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:4510 Date: 2004-10-01T08:26:21-07:00 List-Id: 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? thanks art ----------------------------------------------------------- ----------------------------------------------------------- package a is type X is new Integer; type X_Ptr is access all X; end a; -------------------------------------------------------- -- Main Program 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;