comp.lang.ada
 help / color / mirror / Atom feed
From: Mehdi Saada <00120260a@gmail.com>
Subject: Re: little precision about anonymous access types
Date: Sun, 18 Mar 2018 18:08:16 -0700 (PDT)
Date: 2018-03-18T18:08:16-07:00	[thread overview]
Message-ID: <aaf28d21-b025-4bad-87ed-a3bb1e45ec72@googlegroups.com> (raw)
In-Reply-To: <edf7b96a-f340-408c-994f-d5aa73b9f2db@googlegroups.com>

Also, why that:
procedure main is
   B: access INTEGER;
begin
   declare
      type A_TYPE is access INTEGER;
      A : A_TYPE := new INTEGER'(7);
   begin
      B := A;
   end;
end main;
is ILLEGAL (cannot convert local pointer to non-local access type) ? It seems that B's type's scope is LONGER than A_type's.

whereas that:
procedure main is
   type A_TYPE is access all INTEGER;
   A : A_TYPE;
begin
   declare
      B: access INTEGER := new INTEGER'(7);
   begin
      A := A_TYPE(B);
   end;
   if A.all > 8 then null; end if;
end main;
is legal (yet needs "all" for a reason unknown to me) ?
Since B dies before A, where does go B's memory content, so that A can still refer to it after the "end;" ?


  reply	other threads:[~2018-03-19  1:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19  0:37 little precision about anonymous access types Mehdi Saada
2018-03-19  1:08 ` Mehdi Saada [this message]
2018-03-19  1:18 ` Mehdi Saada
2018-03-19 14:51   ` AdaMagica
2018-03-19 22:40 ` Randy Brukardt
2018-03-20 17:49   ` G. B.
2018-03-20 23:56     ` Mehdi Saada
2018-03-21 22:46       ` Randy Brukardt
2018-05-15  0:20         ` Mehdi Saada
2018-05-15  0:28           ` Mehdi Saada
2018-05-15 21:48             ` Randy Brukardt
2018-05-16  8:14               ` Mehdi Saada
2018-05-16  8:23                 ` Mehdi Saada
2018-05-17 21:20                   ` Randy Brukardt
2018-05-17 21:17                 ` Randy Brukardt
2018-05-17 21:36                   ` J-P. Rosen
2018-05-18  7:44                   ` Dmitry A. Kazakov
2018-05-15 21:44           ` Randy Brukardt
replies disabled

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