Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main() return value #75

Closed
mbndr opened this issue Mar 14, 2017 · 6 comments
Closed

main() return value #75

mbndr opened this issue Mar 14, 2017 · 6 comments

Comments

@mbndr
Copy link
Contributor

mbndr commented Mar 14, 2017

Hey there,
I'm playing with gravity for a while now and I really like it :)
But what I wonder is if the return value of the main() function shouldn't be the return value of the program, so if I write return 5; I assume the program to exit with error code 5. Maybe It's my fault or it's a design decision.
Nice project, have a good time

@marcobambini
Copy link
Owner

Hi, main returns a value in a C program, Gravity simply uses a different convention, it returns what the user decides to return explicitly.

@mbndr
Copy link
Contributor Author

mbndr commented Mar 14, 2017

Ok, is there a way to exit with a specific code? Something like System.exit(5)?

@marcobambini
Copy link
Owner

marcobambini commented Mar 14, 2017

From where?
From the gravity command line utility?
Or from the main function in your c code?
Or you would need a way to abort execution and call c exit function?

@mbndr
Copy link
Contributor Author

mbndr commented Mar 14, 2017

I want to abort the execution in my gravity code so that my last exit code in my shell ($?) gets that.

@marcobambini
Copy link
Owner

I just added a System.exit(n) method: db7c9eb

@mbndr
Copy link
Contributor Author

mbndr commented Mar 14, 2017

Very nice, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@mbndr @marcobambini and others