comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Deallocating an object twice
Date: Sat, 26 Jul 2014 21:42:48 -0500
Date: 2014-07-26T21:42:48-05:00	[thread overview]
Message-ID: <lr1ov9$d7k$1@loke.gir.dk> (raw)
In-Reply-To: lr11gd$log$2@speranza.aioe.org

"Victor Porton" <porton@narod.ru> wrote in message 
news:lr11gd$log$2@speranza.aioe.org...
> Victor Porton wrote:
>
>> If I understand correctly, it is an undefined behavior (or is it called
>> unbounded error?) if a pool access is deallocated twice with
>> Unchecked_Deallocation.
>>
>> I think it should be a Program_Error (if checks are on).
>>
>> Why was not this done even in Ada2012 (not speaking about older Ada)?
>>
>> It's bad.
>>
>> Or is it done and I just miss it?
>
> The same should be done if attempt to deallocate an access which never has
> been allocated (for example, if it is an aliased object on the stack).

In both cases, how would you tell? An access type is just a raw pointer. We 
do such a check in Janus/Ada when we can, but it can be reliably detected in 
only a small percentage of cases. (And if the storage pool is user-defined, 
it's up to the storage pool to deal with this -- the language can't do 
anything.)

There's a reason it's called UNCHECKED_Deallocation, after all.

                                         Randy.


  parent reply	other threads:[~2014-07-27  2:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-26 19:55 Deallocating an object twice Victor Porton
2014-07-26 20:02 ` Victor Porton
2014-07-27  2:39   ` Randy Brukardt
2014-07-27  2:42   ` Randy Brukardt [this message]
2014-07-27  8:31 ` Simon Wright
2014-07-27 11:30 ` anon
2014-07-27 12:47   ` Peter Chapin
2014-07-27 15:29 ` Stephen Leake
2014-07-27 15:34   ` Victor Porton
2014-07-28 15:15     ` Stephen Leake
2014-07-28 16:15       ` Simon Wright
replies disabled

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