delete and references?

Jarrett Billingsley jarrett.billingsley at gmail.com
Sat Aug 8 06:26:24 PDT 2009


On Sat, Aug 8, 2009 at 9:17 AM, Andrei
Alexandrescu<SeeWebsiteForEmail at erdani.org> wrote:
>
> FWIW, I am trying to convince Walter to not reclaim memory in delete, but
> instead only call destructors. D continues C++'s mistake of conflating
> lifetime termination with memory reclamation.

Why?  Instead of dangling pointers, you'd end up with pointers to
finalized objects, which would probably lead to harder-to-catch bugs
(since then you wouldn't even get a segfault).

And what if you used it to try to delete a temporary array?  Yes, you
could use malloc/free for the temp array, but.. it just seems silly to
have to dip into C functions to do that.



More information about the Digitalmars-d mailing list