comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Deallocating an object twice
Date: Mon, 28 Jul 2014 10:15:27 -0500
Date: 2014-07-28T10:15:27-05:00	[thread overview]
Message-ID: <8538dlqzu8.fsf@stephe-leake.org> (raw)
In-Reply-To: lr3658$e1g$1@speranza.aioe.org

Victor Porton <porton@narod.ru> writes:

> Stephen Leake wrote:
>
>> Victor Porton <porton@narod.ru> writes:
>> 
>>> 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.
>> 
>> You misunderstand.
>> 
>> ARM 2012 13.11.3
>> 
>> Procedure Free has the following effect:
>> 
>> 7
>>      1.  After executing Free(X), the value of X is null.
>> 
>> 8
>>      2.  Free(X), when X is already equal to null, has no effect.
>
> No, it is that you misunderstand me:
>
> Second free may be executed not as Free(X) but as Free(Y) where Y was a copy 
> of X (and so Free(X) sets only X to null, it does not set Y to null; and 
> Free(Y) would be erroneous).

Ok, that makes sense. 

Don't copy pointers! It is the copy of the pointer that is bad, not the
behavior of Unchecked_Deallocation.

-- 
-- Stephe

  reply	other threads:[~2014-07-28 15:15 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
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 [this message]
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