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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fa2221f5dd5f5100 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-21 15:02:13 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!oleane.net!oleane!fr.usenet-edu.net!usenet-edu.net!enst.fr!not-for-mail From: "David C. Hoos, Sr." Newsgroups: comp.lang.ada Subject: Re: Newbie question about pointers in GNAT 3.15p on Windows 2000 Date: Fri, 21 Feb 2003 17:03:14 -0600 Organization: ENST, France Message-ID: References: <816517EFDE1ABFFF.672EFD9C99861B55.1999743ACE4BA64B@lp.airnews.net> Reply-To: "comp.lang.ada mail to news gateway" NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1045868532 22786 137.194.161.2 (21 Feb 2003 23:02:12 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Fri, 21 Feb 2003 23:02:12 +0000 (UTC) To: "comp.lang.ada mail to news gateway" Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.1 Precedence: list List-Id: comp.lang.ada mail to news gateway List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:34404 Date: 2003-02-21T17:03:14-06:00 "Local" refers to the declarative region of the function X. That the pointer is "non-local" is a consequence of the fact that the pointer _type_ is not in the local region. It's hard to see what is the point of this exercise, since the value of P_Size is not used. But, in general taking the access of a variable on the stack is not very useful (e.g., to return it as the result of a function), since the local stack variable is subject to corruption upon return from the function. ----- Original Message ----- From: "David Gressett" Newsgroups: comp.lang.ada To: Sent: February 21, 2003 3:20 PM Subject: Newbie question about pointers in GNAT 3.15p on Windows 2000 > > I have the following package which I am trying to compile with GNAT > 3.15p on Windows 2000: > > ----------------------------------------------------------------------- > package Miscellaneous3 is > > > function X > return String; > > end Miscellaneous3; > > > package body Miscellaneous3 is > > ----------------------- > -- X -- > ----------------------- > > type P_Integer is access all Integer; > > function X > return String > is > Bufsize: Aliased Integer; > P_Size: P_Integer; > > begin > Bufsize := 1; > P_Size := BufSize'Access; > return ""; > end X; > > end Miscellaneous3; > > --------------------------------------------------------------------- > Compilation produces this error message: > > miscellaneous3.adb:17:15 non-local pointer cannot point to local > object > > I have no idea what "local" means here - both the pointer P_Size and > the pointed-to variable Bufsize are defined in the same place. > > What am I doing wrong? > > > > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada.eu.org > http://ada.eu.org/mailman/listinfo/comp.lang.ada > >