From: AdaMagica <christ-usch.grein@t-online.de>
Subject: Re: little precision about anonymous access types
Date: Mon, 19 Mar 2018 07:51:37 -0700 (PDT)
Date: 2018-03-19T07:51:37-07:00 [thread overview]
Message-ID: <9aac5f89-e38b-4246-9a5f-8a99bf9a1a38@googlegroups.com> (raw)
In-Reply-To: <d57609d9-581c-4644-9172-c937d1b52a7b@googlegroups.com>
Am Montag, 19. März 2018 02:18:34 UTC+1 schrieb Mehdi Saada:
> At last, I would like to know what happens exactly when one tries to deallocate a pointer, referencing a variable *on the stack* ?
This is erroneous. See in the RM what erroneous means.
Also note that deallocation of an object allocated via new is erroneous when done with a different access type than was used to allocate the object.
Do never ever allocate with anonymous access types.
(Exception: coextensions - which some Ada aficionados consider a bad mistake.)
I do not know where such an object is allocated, so I cannot tell what happens when you convert to a named access type:
declare
type A_TYPE is access all INTEGER;
A : A_TYPE;
begin
declare
B: access INTEGER := new INTEGER'(7);
begin
A := A_TYPE(B);
end;
end;
next prev parent reply other threads:[~2018-03-19 14:51 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
2018-03-19 1:18 ` Mehdi Saada
2018-03-19 14:51 ` AdaMagica [this message]
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