-
Notifications
You must be signed in to change notification settings - Fork 37.7k
bench: Don't return a bool from main #13349
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK cd2e257cb05a89870ac3a511b0e4c4c98b86e93e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK cd2e257cb05a89870ac3a511b0e4c4c98b86e93e
ACK. Also, why does that function not have a return statement at the end? |
Concept ACK. Similar to qt's main we could return |
utACK. @sipa fyi https://stackoverflow.com/a/10079465
@laanwj add return at end? |
utACK cd2e257cb05a89870ac3a511b0e4c4c98b86e93e |
src/bench/bench_bitcoin.cpp
Outdated
@@ -46,7 +46,7 @@ main(int argc, char** argv) | |||
std::string error; | |||
if (!gArgs.ParseParameters(argc, argv, error)) { | |||
fprintf(stderr, "Error parsing command line arguments: %s\n", error.c_str()); | |||
return false; | |||
return 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXIT_FAILURE
would be more explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Would prefer that all returns be updated, including adding an explicit final return (which is currently implicitly 0). |
cd2e257
to
1b612c0
Compare
Return `EXIT_SUCCESS` from `main()` on error, not the bool `false` (introduced in bitcoin#13112). This is the correct value to return on error, and also shuts up a clang warning. Also add a final return for clarity.
1b612c0
to
493a166
Compare
Seemingly, I've been dragged along into updating the function for the latest fashion standards. Please re-review! |
utACK 493a166 |
utACK 493a166. |
493a166 bench: Don't return a bool from main (Wladimir J. van der Laan) Pull request description: Return `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. Tree-SHA512: 52a0f1b2f6ae2697555f71ee2019ce657046f7f379f1f4faf3cce9d5f3fb21fcdc43a4c84895a2a8b6929997ba70bbe87c231f2f9553215b84c22333810d58d9
493a166 bench: Don't return a bool from main (Wladimir J. van der Laan) Pull request description: Return `1` from `main()` on error, not the bool `false` (introduced in bitcoin#13112). This is the correct value to return on error, and also shuts up a clang warning. Tree-SHA512: 52a0f1b2f6ae2697555f71ee2019ce657046f7f379f1f4faf3cce9d5f3fb21fcdc43a4c84895a2a8b6929997ba70bbe87c231f2f9553215b84c22333810d58d9
493a166 bench: Don't return a bool from main (Wladimir J. van der Laan) Pull request description: Return `1` from `main()` on error, not the bool `false` (introduced in bitcoin#13112). This is the correct value to return on error, and also shuts up a clang warning. Tree-SHA512: 52a0f1b2f6ae2697555f71ee2019ce657046f7f379f1f4faf3cce9d5f3fb21fcdc43a4c84895a2a8b6929997ba70bbe87c231f2f9553215b84c22333810d58d9
493a166 bench: Don't return a bool from main (Wladimir J. van der Laan) Pull request description: Return `1` from `main()` on error, not the bool `false` (introduced in bitcoin#13112). This is the correct value to return on error, and also shuts up a clang warning. Tree-SHA512: 52a0f1b2f6ae2697555f71ee2019ce657046f7f379f1f4faf3cce9d5f3fb21fcdc43a4c84895a2a8b6929997ba70bbe87c231f2f9553215b84c22333810d58d9
493a166 bench: Don't return a bool from main (Wladimir J. van der Laan) Pull request description: Return `1` from `main()` on error, not the bool `false` (introduced in bitcoin#13112). This is the correct value to return on error, and also shuts up a clang warning. Tree-SHA512: 52a0f1b2f6ae2697555f71ee2019ce657046f7f379f1f4faf3cce9d5f3fb21fcdc43a4c84895a2a8b6929997ba70bbe87c231f2f9553215b84c22333810d58d9
493a166 bench: Don't return a bool from main (Wladimir J. van der Laan) Pull request description: Return `1` from `main()` on error, not the bool `false` (introduced in bitcoin#13112). This is the correct value to return on error, and also shuts up a clang warning. Tree-SHA512: 52a0f1b2f6ae2697555f71ee2019ce657046f7f379f1f4faf3cce9d5f3fb21fcdc43a4c84895a2a8b6929997ba70bbe87c231f2f9553215b84c22333810d58d9
Return
1
frommain()
on error, not the boolfalse
(introduced in #13112). This is the correct value to return on error, and also shuts up a clang warning.