digitalmars.D.learn - How to exit a process?
- Adam Ruppe (2/2) Dec 06 2010 Is there a thing like C's exit() for a D program? Is
- Andrej Mitrovic (3/5) Dec 06 2010 I usually use assert(0) when I want to forcefully exit a program. It's
- Steven Schveighoffer (9/11) Dec 06 2010 Yes, it will work.
- Adam Ruppe (3/3) Dec 06 2010 Thanks, everyone. I wasn't using any resources that
- spir (10/12) Dec 06 2010 I use:
- Stanislav Blinov (2/4) Dec 07 2010 Also take a look at core.runtime.Runtime.terminate()
Is there a thing like C's exit() for a D program? Is simply using C's function good enough?
Dec 06 2010
I usually use assert(0) when I want to forcefully exit a program. It's compiled in both debug/release modes. On 12/6/10, Adam Ruppe <destructionator gmail.com> wrote:Is there a thing like C's exit() for a D program? Is simply using C's function good enough?
Dec 06 2010
On Mon, 06 Dec 2010 14:11:59 -0500, Adam Ruppe <destructionator gmail.com> wrote:Is there a thing like C's exit() for a D program? Is simply using C's function good enough?Yes, it will work. Note that it does not gracefully shut down a process. Anything outside the process that is left in an intermediate state will not be cleaned up. For instance, if you created a lock file, it will remain. But in general, it's safe to use, the OS will clean up the memory and open handles, etc. -Steve
Dec 06 2010
Thanks, everyone. I wasn't using any resources that needed explicit cleanup (no scope exits etc) so I just used the C exit and it worked well.
Dec 06 2010
On Mon, 6 Dec 2010 19:11:59 +0000 (UTC) Adam Ruppe <destructionator gmail.com> wrote:Is there a thing like C's exit() for a D program? Is simply using C's function good enough?I use: import core.stdc.stdlib : exit; // debug tool func void stop () {exit(0);} denis -- -- -- -- -- -- -- vit esse estrany =E2=98=A3 spir.wikidot.com
Dec 06 2010
06.12.2010 22:11, Adam Ruppe пишет:Is there a thing like C's exit() for a D program? Is simply using C's function good enough?Also take a look at core.runtime.Runtime.terminate()
Dec 07 2010