On Friday, 11 August 2017 at 17:10:14 UTC, bitwise wrote:
On Friday, 11 August 2017 at 17:02:20 UTC, HyperParrow wrote:
On Friday, 11 August 2017 at 16:53:02 UTC, bitwise wrote:
What do they do?
What's the difference?

Thanks

__xdtor() also calls the __dtor() that are mixed with template mixins while __dtor() only call the __dtor() that matches to the normal ~this(){}

Ok thanks.

I don't understand why you would ever want to call __dtor then...

Indeed. And there's also another one for the field called __fieldDtor.

is it possible to have only __dtor without also having __xdtor? Like, if I want to call a struct's destructor, do I have to check for both, or can I just always check for, and call __xdtor?

Always use __xdtor unless you know there's no other destructor to call. Actually these functions are an implementation details and should be only used for low level things like custom memory handling.

You can look at core/lifetime.d to see how it's used by the d runtime.


Reply via email to