Re: __dtor vs __xdtor

2017-08-12 Thread Marco Leise via Digitalmars-d-learn
Am Fri, 11 Aug 2017 17:10:14 + schrieb bitwise : > 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

Re: __dtor vs __xdtor

2017-08-11 Thread bitwise via Digitalmars-d-learn
On Friday, 11 August 2017 at 17:20:18 UTC, HyperParrow wrote: [...] I made a mistake but it's not about i, which is a global. I meant "other.__dtor." just before the last assert. This doesn't change the results. hmm...indeed ;) On Friday, 11 August 2017 at 17:24:17 UTC, HyperParrow wrote:

Re: __dtor vs __xdtor

2017-08-11 Thread HyperParrow via Digitalmars-d-learn
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

Re: __dtor vs __xdtor

2017-08-11 Thread HyperParrow via Digitalmars-d-learn
On Friday, 11 August 2017 at 17:12:22 UTC, bitwise wrote: On Friday, 11 August 2017 at 17:06:40 UTC, HyperParrow wrote: [...] int i; struct Foo { template ToMix(){ ~this(){i;}} ~this(){++i;} mixin ToMix; } void main() { Foo* foo = new Foo; foo.__xdtor; assert(i==3);

Re: __dtor vs __xdtor

2017-08-11 Thread bitwise via Digitalmars-d-learn
On Friday, 11 August 2017 at 17:06:40 UTC, HyperParrow wrote: [...] int i; struct Foo { template ToMix(){ ~this(){i;}} ~this(){++i;} mixin ToMix; } void main() { Foo* foo = new Foo; foo.__xdtor; assert(i==3); Foo* other = new Foo; foo.__dtor;

Re: __dtor vs __xdtor

2017-08-11 Thread bitwise via Digitalmars-d-learn
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

Re: __dtor vs __xdtor

2017-08-11 Thread HyperParrow via Digitalmars-d-learn
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

Re: __dtor vs __xdtor

2017-08-11 Thread HyperParrow via Digitalmars-d-learn
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(){}

__dtor vs __xdtor

2017-08-11 Thread bitwise via Digitalmars-d-learn
What do they do? What's the difference? Thanks