just stop program

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Fri Nov 5 05:41:41 PDT 2010


On Fri, 05 Nov 2010 13:20:12 +0100, spir wrote:

> On Fri, 05 Nov 2010 09:47:37 +0000
> div0 <div0 at sourceforge.net> wrote:
> 
>> On 05/11/2010 09:32, spir wrote:
>> > Hello,
>> >
>> > Is there a way for a program to simply exit before end of main()? An
>> > instruction like exit, quit, end, halt, stop...
>> >
>> > [assert(false) is not why I'm looking for, as (1) the compiler
>> > protests if there is unreachable code (2) it throws in non-release
>> > mode. I just want the program to stop, basta! My use case is first
>> > debugging (avoid later debug output to be written on terminal).]
>> >
>> > Denis
>> > -- -- -- -- -- -- --
>> > vit esse estrany ☣
>> >
>> > spir.wikidot.com
>> >
>> >
>> import std.c.process
>> 
>> then you've exit(int) & abort()
>> 
>> You can get access to most C library functions through std.c.*, so it's
>> always worth a quick check in there for lower level stuff.
>> 
>> 
> Thank you, that's what I was looking for. I don't know much about C
> libs. For me, such functionality belongs to plain D libs, as not only
> people translating or interfacing with C code need it, I guess. Thanks
> also to Lars for the precision about core.stdc... But I cannot find its
> doc online.

core.stdc.* contains the entire C standard library, for which there are 
plenty of references online.  I guess people felt it a waste of time to 
write another one. :)  Here's one, for instance:

  http://www.utas.edu.au/infosys/info/documentation/C/CStdLib.html

(Each .h file corresponds to a module in core.stdc.)

But I agree with you -- at the very least the function signatures should 
be listed in the D documentation, so it's easier to get the types right.  
Until that happens, you can look at them here:

  http://www.dsource.org/projects/druntime/browser/trunk/src/core/stdc

-Lars


More information about the Digitalmars-d-learn mailing list