1
from main()
on error, not the bool false
(introduced in #13112). This is the correct value to return on error, and also shuts up a clang warning.
EXIT_SUCCESS
at the end or EXIT_FAILURE
on an init error.
utACK. @sipa fyi https://stackoverflow.com/a/10079465
From the C Standard: (C99, 6.9.1p12) “If the } that terminates a function is reached, and the value of the function call is used by the caller, the behavior is undefined.” The main function is an exception to this rule as if the } is reached in main it is equivalent as if there was a return 0; statement. @laanwj add return at end?
45@@ -46,7 +46,7 @@ main(int argc, char** argv)
46 std::string error;
47 if (!gArgs.ParseParameters(argc, argv, error)) {
48 fprintf(stderr, "Error parsing command line arguments: %s\n", error.c_str());
49- return false;
50+ return 1;
EXIT_FAILURE
would be more explicit.
Is it? I’m not sure. I’ve always found those constants quite useless. I prefer using the explicit status codes, it is more flexible if want to use other codes than just 0 and 1 in the future.
Edit: I’ll do it, just only for consistency with the other files.
Return `EXIT_SUCCESS` from `main()` on error, not the bool `false`
(introduced in #13112). This is the correct value to return on error,
and also shuts up a clang warning.
Also add a final return for clarity.