digitalmars.D - how to terminate a program
- james (1/1) Oct 24 2008 how to terminate the program in the middle of execution, is there any co...
- dsimcha (4/5) Oct 24 2008 such as halt,exit? since i dont use exception for error handling.
- james (2/8) Oct 24 2008 thank you very much. it works.
- Murilo (4/12) Sep 14 2019 Hi, I am trying it but my compiler does not find the std.c.stdlib
- Jonathan M Davis (7/22) Sep 14 2019 You're replying to a post that's nearly 11 years old. The C bindings wer...
- Murilo (1/6) Sep 15 2019 Thanks man. Importing core.stdc.stdlib really worked. :)
- FeepingCreature (11/22) Sep 16 2019 Gonna take this opportunity to bring up two related concerns.
- Jonathan M Davis (4/28) Sep 17 2019 Calling exit is akin to just shooting your process in the head.
how to terminate the program in the middle of execution, is there any command such as halt,exit? since i dont use exception for error handling.
Oct 24 2008
== Quote from james (james google.com)'s articlehow to terminate the program in the middle of execution, is there any commandsuch as halt,exit? since i dont use exception for error handling. Use C's. It's in std.c.stdlib. It's called exit, takes an int and returns the exit code provided by the caller to the OS upon termination.
Oct 24 2008
dsimcha Wrote:== Quote from james (james google.com)'s articlethank you very much. it works.how to terminate the program in the middle of execution, is there any commandsuch as halt,exit? since i dont use exception for error handling. Use C's. It's in std.c.stdlib. It's called exit, takes an int and returns the exit code provided by the caller to the OS upon termination.
Oct 24 2008
On Saturday, 25 October 2008 at 01:41:09 UTC, dsimcha wrote:== Quote from james (james google.com)'s articleHi, I am trying it but my compiler does not find the std.c.stdlib module. I am using one of the latest versions. Has it been removed?how to terminate the program in the middle of execution, is there any commandsuch as halt,exit? since i dont use exception for error handling. Use C's. It's in std.c.stdlib. It's called exit, takes an int and returns the exit code provided by the caller to the OS upon termination.
Sep 14 2019
On Saturday, September 14, 2019 9:37:37 PM MDT Murilo via Digitalmars-d wrote:On Saturday, 25 October 2008 at 01:41:09 UTC, dsimcha wrote:You're replying to a post that's nearly 11 years old. The C bindings were moved to druntime quite some time ago. The bindings for C's standard library are in the package core.stdc. So, the bindings for C's stdlib header are in core.stdc.stdlib. - Jonathan M Davis== Quote from james (james google.com)'s articleHi, I am trying it but my compiler does not find the std.c.stdlib module. I am using one of the latest versions. Has it been removed?how to terminate the program in the middle of execution, is there any commandsuch as halt,exit? since i dont use exception for error handling. Use C's. It's in std.c.stdlib. It's called exit, takes an int and returns the exit code provided by the caller to the OS upon termination.
Sep 14 2019
You're replying to a post that's nearly 11 years old. The C bindings were moved to druntime quite some time ago. The bindings for C's standard library are in the package core.stdc. So, the bindings for C's stdlib header are in core.stdc.stdlib. - Jonathan M DavisThanks man. Importing core.stdc.stdlib really worked. :)
Sep 15 2019
On Sunday, 15 September 2019 at 03:54:01 UTC, Jonathan M Davis wrote:On Saturday, September 14, 2019 9:37:37 PM MDT Murilo via Digitalmars-d wrote:Gonna take this opportunity to bring up two related concerns. First: when you exit the program via exit(), module destructors will not be run. As a result, any modules that rely on this, such as database drivers that close file handles, flush caches to disk, etc. will not get a chance to react. On the other hand, you will also sidestep issue 19978 which notes that sometimes, D programs (with daemon threads) just randomly crash on exit and nobody knows why. So you know, you win some, you lose some. :-)Hi, I am trying it but my compiler does not find the std.c.stdlib module. I am using one of the latest versions. Has it been removed?You're replying to a post that's nearly 11 years old. The C bindings were moved to druntime quite some time ago. The bindings for C's standard library are in the package core.stdc. So, the bindings for C's stdlib header are in core.stdc.stdlib. - Jonathan M Davis
Sep 16 2019
On Monday, September 16, 2019 1:24:02 AM MDT FeepingCreature via Digitalmars-d wrote:On Sunday, 15 September 2019 at 03:54:01 UTC, Jonathan M Davis wrote:Calling exit is akin to just shooting your process in the head. - Jonathan M DavisOn Saturday, September 14, 2019 9:37:37 PM MDT Murilo via Digitalmars-d wrote:Gonna take this opportunity to bring up two related concerns. First: when you exit the program via exit(), module destructors will not be run. As a result, any modules that rely on this, such as database drivers that close file handles, flush caches to disk, etc. will not get a chance to react. On the other hand, you will also sidestep issue 19978 which notes that sometimes, D programs (with daemon threads) just randomly crash on exit and nobody knows why. So you know, you win some, you lose some. :-)Hi, I am trying it but my compiler does not find the std.c.stdlib module. I am using one of the latest versions. Has it been removed?You're replying to a post that's nearly 11 years old. The C bindings were moved to druntime quite some time ago. The bindings for C's standard library are in the package core.stdc. So, the bindings for C's stdlib header are in core.stdc.stdlib. - Jonathan M Davis
Sep 17 2019