On 06/01/2012 14:44, Andrej Mitrovic wrote:
Just implement your own exception type, e.g. ExitException, and then use:
That's more or less what people have already said. What's more, Ashish has already suggested a further improvement whereby the custom exception carries an exit code.
void main() { try { realMain(); } catch (ExitException e) { return 0; }
<snip>
That should have been int main.
That's not the only typo - you've forgotten to finish that function with a return for if ExitException is never thrown and a closing }.
Stewart.