__dtor vs __xdtor
    Marco Leise via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sat Aug 12 06:15:18 PDT 2017
    
    
  
Am Fri, 11 Aug 2017 17:10:14 +0000
schrieb bitwise <bitwise.pvt at gmail.com>:
> Ok thanks.
> 
> I don't understand why you would ever want to call __dtor 
> then...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?
I think it was simply that all the special methods needed a
symbol name, so this() was called __ctor and ~this() was
called __dtor. It was never supposed to cover field
destruction, mixed in destructors or inheritance in classes.
User code was not expected to call these directly anyways.
Not very long ago __xdtor and __xpostblit were introduced
that wrap up the entire finalization and copy operation.
__dtor will remain as the 1:1 representation of the ~this()
method.
-- 
Marco
    
    
More information about the Digitalmars-d-learn
mailing list