From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: non-local pointer cannot point to local object
Date: Fri, 23 Feb 2018 18:16:14 +0100
Date: 2018-02-23T18:16:14+01:00 [thread overview]
Message-ID: <p6pi8u$1gtc$1@gioia.aioe.org> (raw)
In-Reply-To: fd1bea7e-5b0f-4aff-8df6-dd41966b74f2@googlegroups.com
On 2018-02-23 17:56, Mehdi Saada wrote:
> type POINTER is access all INTEGER;
> Long: POINTER
procedure Copy (X : POINTER) is
begin
Long := X;
end Copy;
> declare
> Local: aliased INTEGER := -42;
> SHORT: POINTEUR := LOCAL'Access;
> begin
> Long := LOCAL'Access;
Copy (Short);
> end;
> ...Long is a dangling reference after the "end", but SHORT never becomes one. Why must SHORT := LOCAL'Access be forbidden, can't the compiler see that no assignation to outliving variable can happen ?
It cannot without global analysis, so a nuclear solution...
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
prev parent reply other threads:[~2018-02-23 17:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox