[Issue 9433] Deprecate delete

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 31 08:12:01 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9433


Jonathan M Davis <jmdavisProg at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg at gmx.com


--- Comment #3 from Jonathan M Davis <jmdavisProg at gmx.com> 2013-01-31 08:12:00 PST ---
delete has been on the chopping block for ages. I don't know why it hasn't
actually been deprecated yet. It should have been deprecated quite some time
ago.

> Delete cannot be deprecated because there is no properly working replacement
> for delete at this moment.

There really isn't supposed to be a replacement for it. Part of the point is
that what it's doing is fundamentally wrong. You shouldn't normally be freeing
memory that's managed by the GC. That's the job of the GC, and it's unsafe for
the programmer to do it. If you really want to be freeing memory yourself, then
you should be managing it manually with malloc and free and not with new and
delete.

Now, manual memory management should become much nicer once custom allocators
have been sorted out (allocating classes manually is a bit of a pain at the
moment), but in general, if you're using delete, you're going about things the
wrong way.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list