comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Preventing Unchecked_Deallocation?
Date: Mon, 6 Feb 2012 08:05:22 -0800 (PST)
Date: 2012-02-06T08:05:22-08:00	[thread overview]
Message-ID: <bef20148-f2e3-4278-9320-898d6537807c@1g2000yqv.googlegroups.com> (raw)
In-Reply-To: d2f6c17f-e7e6-44d4-9c28-1219e4f62f02@z31g2000vbt.googlegroups.com

On Feb 6, 4:52 am, Julian Leyh <jul...@vgai.de> wrote:
> On 5 Feb., 17:42, Simon Belmont <sbelmont...@gmail.com> wrote:
>
> > package ud is
> >   function Get return not null access Integer;
> > end ud;
>
> > package body ud is
> >   type Int_Ptr is access all Integer;
> >   o : Int_Ptr := new Integer'(42);
>
> use o : constant Int_Ptr := ....

Ummm, no.  All that does is prevent the variable "o" from being
modified inside the body of UD.  That means that if Free is an
instance of Unchecked_Deallocation, the body of UD can't call

   Free (o);

but that doesn't prevent

   x := o;       -- where x is a variable
   Free (x);

or

   x := Get;
   Free (x);

And "o" will point to a non-existing object.

                            -- Adam



  reply	other threads:[~2012-02-06 16:05 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02 23:41 Preventing Unchecked_Deallocation? Simon Belmont
2012-02-04 14:40 ` AdaMagica
2012-02-05 16:42   ` Simon Belmont
2012-02-06 12:52     ` Julian Leyh
2012-02-06 16:05       ` Adam Beneschan [this message]
2012-02-06 16:21     ` Adam Beneschan
2012-02-06 18:34       ` AdaMagica
2012-02-07  0:14       ` Simon Belmont
2012-02-07  2:19         ` Shark8
2012-02-07 16:39           ` Robert A Duff
2012-02-07 11:42         ` Gautier write-only
2012-02-07 21:11           ` Simon Belmont
2012-02-07 21:30             ` Robert A Duff
2012-02-07 22:23               ` Simon Wright
2012-02-07 23:07                 ` Robert A Duff
2012-02-08  8:43                   ` Simon Wright
2012-02-08 15:06                     ` Robert A Duff
2012-02-09  2:22                     ` Randy Brukardt
2012-02-09  7:28                       ` Simon Wright
2012-02-07 23:06               ` Alan Copeland
2012-02-07 23:10                 ` Robert A Duff
2012-02-09  2:49         ` Randy Brukardt
2012-02-09  3:39           ` Jeffrey Carter
2012-02-09 15:47             ` Adam Beneschan
2012-02-09 19:16               ` Jeffrey Carter
2012-02-09  7:37           ` Simon Wright
2012-02-10  1:08             ` Randy Brukardt
2012-02-10  7:35               ` Simon Wright
2012-02-07  6:26     ` Jeffrey Carter
2012-02-08  8:49       ` Maciej Sobczak
2012-02-08 23:40         ` BrianG
2012-02-09  2:57         ` Randy Brukardt
2012-02-09  7:13           ` Pascal Obry
2012-02-10  1:12             ` Randy Brukardt
2012-02-09  8:08           ` Maciej Sobczak
2012-02-10  1:18             ` Randy Brukardt
2012-02-07 16:27     ` Robert A Duff
replies disabled

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