Re: How do I properly exit from a D program (outside main)?

2014-09-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 16/09/14 02:06, AsmMan wrote: Neither assert or return will help. Check out this code example: void main() { f(); } void f() { if(!foo) exit(1); do_something(); } If you want to exit the application with exit code 1 then it sounds like something has gone wrong. In that case,

How do I properly exit from a D program (outside main)?

2014-09-15 Thread AsmMan via Digitalmars-d-learn
Someone said somewhere that call std.c.process.exit() isn't the proper way to exit from a D program since it doesn't terminate some phobos stuff. So what should I use instead of? or there's no a replacement?

Re: How do I properly exit from a D program (outside main)?

2014-09-15 Thread notna via Digitalmars-d-learn
how about return? :) there is also assert... and pls note, scope could also be your friend :O On Monday, 15 September 2014 at 23:36:56 UTC, AsmMan wrote: Someone said somewhere that call std.c.process.exit() isn't the proper way to exit from a D program since it doesn't terminate some

Re: How do I properly exit from a D program (outside main)?

2014-09-15 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Sep 15, 2014 at 11:36:54PM +, AsmMan via Digitalmars-d-learn wrote: Someone said somewhere that call std.c.process.exit() isn't the proper way to exit from a D program since it doesn't terminate some phobos stuff. So what should I use instead of? or there's no a replacement? AFAIK,

Re: How do I properly exit from a D program (outside main)?

2014-09-15 Thread AsmMan via Digitalmars-d-learn
On Monday, 15 September 2014 at 23:52:25 UTC, H. S. Teoh via Digitalmars-d-learn wrote: On Mon, Sep 15, 2014 at 11:36:54PM +, AsmMan via Digitalmars-d-learn wrote: Someone said somewhere that call std.c.process.exit() isn't the proper way to exit from a D program since it doesn't terminate

Re: How do I properly exit from a D program (outside main)?

2014-09-15 Thread AsmMan via Digitalmars-d-learn
On Monday, 15 September 2014 at 23:42:02 UTC, notna wrote: how about return? :) there is also assert... and pls note, scope could also be your friend :O On Monday, 15 September 2014 at 23:36:56 UTC, AsmMan wrote: Someone said somewhere that call std.c.process.exit() isn't the proper way to