digitalmars.D - Abstract exit success/failure codes
- Andrew Pennebaker (5/5) Dec 05 2018 Most operating systems today use the convention of 0 => success,
- Paul Backus (10/15) Dec 05 2018 EXIT_FAILURE and EXIT_SUCCESS are defined in the D module
- Adam D. Ruppe (7/9) Dec 06 2018 Well, D follows and offers the C way, but there is also another:
Most operating systems today use the convention of 0 => success, non-zero => fail for exit codes, but not all. Might D offer a standard way to refer to a successful exit code vs. a failing exit code, to foster cross-platform programs out of the box? Some other languages already do this.
Dec 05 2018
On Thursday, 6 December 2018 at 03:14:24 UTC, Andrew Pennebaker wrote:Most operating systems today use the convention of 0 => success, non-zero => fail for exit codes, but not all. Might D offer a standard way to refer to a successful exit code vs. a failing exit code, to foster cross-platform programs out of the box? Some other languages already do this.EXIT_FAILURE and EXIT_SUCCESS are defined in the D module core.stdc.stdlib [1], which corresponds to the standard C header stdlib.h. The convention that 0 means the same thing as EXIT_SUCCESS is part of the C standard [2], so it should be portable to any platform that supports standard C. [1] https://dlang.org/phobos/core_stdc_stdlib.html
Dec 05 2018
On Thursday, 6 December 2018 at 03:14:24 UTC, Andrew Pennebaker wrote:Most operating systems today use the convention of 0 => success, non-zero => fail for exit codes, but not all.Well, D follows and offers the C way, but there is also another: return void. If you return void from main, the runtime library automatically handles the return value. If no exception, it returns success, if exception, it returns failure.
Dec 06 2018









Paul Backus <snarwin gmail.com> 