Why is "delete" unsafe?
simen.kjaras at gmail.com
Wed Sep 23 06:39:21 UTC 2020
On Wednesday, 23 September 2020 at 04:15:51 UTC, mw wrote:
>> It's there because there _are_ times when it makes sense and
>> is useful, but it's definitely not safe, so you have to be
>> careful and know what you're doing.
> What do you mean by saying "it's definitely not safe" here?
> I mean: if I'm careful and know what I'm doing, e.g. remove all
> the reference to any part of the `object` before call
> core.memory.GC.free(object), is there still any inherit
> "unsafe" side of `free` I should be aware of?
> FYI: I just described my use case here:
If there are no lingering references, the function calling free()
can safely be made @trusted.
More information about the Digitalmars-d-learn