Re: scope(exit) and destructor prioity

2017-09-18 Thread Moritz Maxeiner via Digitalmars-d-learn
On Monday, 18 September 2017 at 20:55:21 UTC, Sasszem wrote: If I write "auto a = new De()", then it calls the scope first, no matter where I place it. Because with `new` a) your struct object is located on the heap (and referred to by pointer - `De*`) instead of the stack (which means no

Re: scope(exit) and destructor prioity

2017-09-18 Thread Eugene Wissner via Digitalmars-d-learn
On Monday, 18 September 2017 at 20:55:21 UTC, Sasszem wrote: On Monday, 18 September 2017 at 20:30:20 UTC, Jerry wrote: On Monday, 18 September 2017 at 20:26:05 UTC, Sasszem wrote: [...] It's called inbetween the destructors of wherever you put the scope(exit). import std.stdio; struct

Re: scope(exit) and destructor prioity

2017-09-18 Thread Sasszem via Digitalmars-d-learn
On Monday, 18 September 2017 at 20:30:20 UTC, Jerry wrote: On Monday, 18 September 2017 at 20:26:05 UTC, Sasszem wrote: [...] It's called inbetween the destructors of wherever you put the scope(exit). import std.stdio; struct De { ~this() { writeln("De"); } } void main() {

Re: scope(exit) and destructor prioity

2017-09-18 Thread Jerry via Digitalmars-d-learn
On Monday, 18 September 2017 at 20:26:05 UTC, Sasszem wrote: I'm currently working on a project and for that I've created a thin OO-wrapper on top of derelict-sdl. However, when I close my app, the program terminates with a segfault. I've managed to track down the source, and found that the

scope(exit) and destructor prioity

2017-09-18 Thread Sasszem via Digitalmars-d-learn
I'm currently working on a project and for that I've created a thin OO-wrapper on top of derelict-sdl. However, when I close my app, the program terminates with a segfault. I've managed to track down the source, and found that the destructors of my objects are called AFTER the scope(exit)