comp.lang.ada
 help / color / mirror / Atom feed
* non-local pointer cannot point to local object
@ 2018-02-23  8:54 artium
  2018-02-23  9:22 ` J-P. Rosen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: artium @ 2018-02-23  8:54 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-24  8:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-23  8:54 non-local pointer cannot point to local object artium
2018-02-23  9:22 ` J-P. Rosen
2018-02-24  8:13   ` gautier_niouzes
2018-02-23  9:42 ` Dmitry A. Kazakov
2018-02-23 12:19 ` AdaMagica
2018-02-23 16:56   ` Mehdi Saada
2018-02-23 17:16     ` Dmitry A. Kazakov

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