comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst-u@mib.org>
Subject: Re: Unchecked_Deallocation vs. delete
Date: Wed, 09 May 2007 13:59:55 -0700
Date: 2007-05-09T13:59:55-07:00	[thread overview]
Message-ID: <lnabwdsofo.fsf@nuthaus.mib.org> (raw)
In-Reply-To: 1hzydt9ej6az6$.12jl0su9budun.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> On 9 May 2007 09:27:25 -0700, Maciej Sobczak wrote:
>> What's the benefit of Unchecked_Deallocation as a generic library
>> procedure vs. built-in deallocation operator like delete in C++?
>
> To make it harder to use.
[...]

Yes.  Allocation is safe; it either succeeds or fails cleanly.
Deallocation, if you happen to deallocate the wrong thing, can fail in
arbitrarily bad ways.  Requiring you to instantiate
Unchecked_Deallocation (emphasis on "Unchecked") is intended as a
reminder that it's entirely up to *you* to get it right; if you mess
up the argument, the implementation isn't going to save you.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://users.sdsc.edu/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"



  parent reply	other threads:[~2007-05-09 20:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-09 16:27 Unchecked_Deallocation vs. delete Maciej Sobczak
2007-05-09 17:02 ` Dmitry A. Kazakov
2007-05-09 20:56   ` Robert A Duff
2007-05-09 20:59   ` Keith Thompson [this message]
2007-05-10 20:09   ` Maciej Sobczak
2007-05-11  7:35     ` Dmitry A. Kazakov
2007-05-11  8:15       ` Maciej Sobczak
2007-05-11 16:39         ` Dmitry A. Kazakov
2007-05-16 19:25         ` Randy Brukardt
2007-05-10 21:10   ` Markus E Leypold
2007-05-09 17:51 ` Martin Krischik
2007-05-09 20:54 ` 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