Open
Conversation
*pthread_create(3)* states that the ways for a pthread to exit includes: > It returns from start_routine(). This is equivalent to calling pthread_exit(3) with the value supplied in the return statement. This "retval" is a void pointer which can be anything. In this case, since all threads are always joined with a parameter of NULL for the `void**` to store the retval this isn't really relevant for providing a meaningful return value. However a `void*` function must return a `void*`, otherwise compilers will complain: > pHash.cpp:416:1: warning: no return statement in function returning non-void [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wreturn-type-Wreturn-type8;;] Therefore returning NULL seems reasonable. As for the choice of NULL vs. nullptr or any other value, NULL is already widely used in the file. Long story short: this fixes a compiler warning/error. Signed-off-by: benaryorg <binary@benary.org>
I'm trying not to conjure a tabs vs. spaces debate here. The indents were clearly 8 in width for the spaces lines, however the rest of the file is mostly 4 in width where indent is spaces. Using hard tabs instead of soft tabs simply side-steps the entire "4 or 8" debate and also is an accessibility feature. Signed-off-by: benaryorg <binary@benary.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pthread_create(3) states that the ways for a pthread to exit includes:
This "retval" is a void pointer which can be anything.
In this case, since all threads are always joined with a parameter of NULL for the
void**to store the retval this isn't really relevant for providing a meaningful return value.However a
void*function must return avoid*, otherwise compilers will complain:Therefore returning NULL seems reasonable.
As for the choice of NULL vs. nullptr or any other value, NULL is already widely used in the file.
Long story short: this fixes a compiler warning/error.
Other than that I fixed the indents on that function because it doesn't follow the same spacing as the rest of the file and therefore either that code or all other code in the file looked scuffed in any interface/editor. I can drop that commit if needed (it has a commit message with some context).