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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.16.11 with SMTP id 11mr987988ity.15.1519376067438; Fri, 23 Feb 2018 00:54:27 -0800 (PST) X-Received: by 10.157.0.5 with SMTP id 5mr42223ota.0.1519376067133; Fri, 23 Feb 2018 00:54:27 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!w142no678958ita.0!news-out.google.com!s63ni1943itb.0!nntp.google.com!w142no678954ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 23 Feb 2018 00:54:26 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=109.64.194.1; posting-account=gqw3dgoAAAC1n0FUnjZEhXcW3umVS9pY NNTP-Posting-Host: 109.64.194.1 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <15e8a72b-3644-4193-8947-b0aaf587c1c2@googlegroups.com> Subject: non-local pointer cannot point to local object From: artium@nihamkin.com Injection-Date: Fri, 23 Feb 2018 08:54:27 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 1838 X-Received-Body-CRC: 2467951822 Xref: reader02.eternal-september.org comp.lang.ada:50586 Date: 2018-02-23T00:54:26-08:00 List-Id: I am cross costing a question from SO since it looks like all the Ada experts are here and not there :) https://stackoverflow.com/questions/48939845/non-local-pointer-cannot-point-to-local-object Can someone explain why I get "non-local pointer cannot point to local object" error, even though it looks like "Arr" and "Arr_Access" have the same accessibility level? Can I overcome the problem without dynamically allocating memory and without using "Unchecked_Access"? with Interfaces.C; with Interfaces.C.Strings; procedure X is type Integer_Access is access all Integer; Arr_Access : Interfaces.C.Strings.char_array_access; Arr : aliased Interfaces.C.char_array := Interfaces.C.To_C ("From"); A : Integer_Access; I : aliased Integer := 6; begin Arr_Access := Arr'Access; A := I'Access; end X; Thank you, Artium