about destroy and delete.
Dsby via Digitalmars-d
digitalmars-d at puremagic.com
Thu Apr 21 03:30:51 PDT 2016
On Wednesday, 20 April 2016 at 09:00:41 UTC, Daniel Kozak wrote:
> On Wednesday, 20 April 2016 at 08:10:15 UTC, Dsby wrote:
>> I see https://dlang.org/deprecate.html#delete
>> ...
>> so, I want to know why don't destroy direct printf ?
>
> if you call destroy on struct pointer it is same as assign null
> to it
> so
> destroy(s) is same as s = null;
>
> OK it is more like
>
> s = (Struct*).init;
>
> But if you do (*s).destroy(), it will work (ok it will call
> destructor two times but thats not error)
>
> Or if you use class instead of struct it will works as you
> expected
Thanks for all.
More information about the Digitalmars-d
mailing list