-
Notifications
You must be signed in to change notification settings - Fork 65
[ML] Use nullptr instead of 0 in core lib #35
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
lib/core/CThread.cc
Outdated
@@ -61,25 +61,30 @@ namespace ml | |||
namespace core | |||
{ | |||
|
|||
#ifdef MacOSX | |||
CThread::TThreadId CThread::UNALLOCATED_THREAD_ID = nullptr; |
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.
On macos _darwin_pthread_t
is defined to be a pointer see /usr/include/sys/_pthread/_pthread_types.h on Linux pthread_t is an arithmetic type.
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.
I think you could just write this:
CThread::TThreadId CThread::UNALLOCATED_THREAD_ID{};
and avoid the #ifdef
.
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.
👍
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.
LGTM
@edsavage could you review this please. Rebasing on the code style commit introduced a lot of chanages |
I think it's worth backporting this to 6.3, otherwise it will cause clashes in other backports. |
The latest version of llvm on macos will warn if
0
is used instead ofnullptr
(-Wzero-as-null-pointer-constant). GCC already has a similar warning.This PR replaces
0
withnullptr
I intend to do the entire code base but this change is already large so I will break it up by the libraries.Backport pending