www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Does D supply basic error codes?

reply NewName <b5458980 nwldx.com> writes:
Hello all.
C has EXIT_FAILURE and EXIT_SUCCESS to be returned from main().
Does D have similar predefined values?
Jan 29 2012
next sibling parent reply mta`chrono <chrono mta-international.net> writes:
import core.stdc.stdlib;

int main()
{
	return EXIT_FAILURE; // EXIT_SUCCESS works here too.
}


Am 30.01.2012 00:21, schrieb NewName:
 Hello all.
 C has EXIT_FAILURE and EXIT_SUCCESS to be returned from main().
 Does D have similar predefined values?

Jan 29 2012
next sibling parent bearophile <bearophileHUGS lycos.com> writes:
mta`chrono:

 import core.stdc.stdlib;
 
 int main()
 {
 	return EXIT_FAILURE; // EXIT_SUCCESS works here too.
 }

And in D void main(){} returns a EXIT_SUCCESS. Bye, bearophile
Jan 29 2012
prev sibling parent "Jesse Phillips" <jessekphillips+D gmail.com> writes:
On Sunday, 29 January 2012 at 23:58:50 UTC, bearophile wrote:
 mta`chrono:

 import core.stdc.stdlib;
 
 int main()
 {
 	return EXIT_FAILURE; // EXIT_SUCCESS works here too.
 }

And in D void main(){} returns a EXIT_SUCCESS. Bye, bearophile

Except when exited due to an exception thrown.
Jan 29 2012
prev sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Sunday, January 29, 2012 23:21:16 NewName wrote:
 Hello all.
 C has EXIT_FAILURE and EXIT_SUCCESS to be returned from main().
 Does D have similar predefined values?

No, but you can use the C ones if you want, as mta`chrono points out. - Jonathan M Davis
Jan 29 2012