about destroy and delete.
Daniel Kozak via Digitalmars-d
digitalmars-d at puremagic.com
Wed Apr 20 02:00:41 PDT 2016
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
More information about the Digitalmars-d
mailing list