-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Don't use zero as null pointer constant. Use nullptr (C++11). #13802
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
Don't use zero as null pointer constant. Use nullptr (C++11). #13802
Conversation
fc6c44b to
f0ea2eb
Compare
|
Concept ACK. |
Note to reviewers: This pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
If this is going to be done, shouldn't |
|
@fanquake Yes that would be the best way to make sure we don't regress! Unfortunately |
In which case I suggest to do the same as with |
|
@MarcoFalke Oh, I'd love enabling that warning but in contrast to shadowing I think the probably of regressions is much lower – hopefully making this a one time "switch to C++11" change. New code is unlikely to use I'd assume the instances changed here are from the pre-C++11 era. |
|
Fine, |
|
@MarcoFalke Correct! Type safety is our friend. This change is safe:
So yes, if it compiles it is safe :-) |
f0ea2eb to
08c2760
Compare
|
Weak concept NAK, but I'm okay with it if others are (I understand it's safe if it compiles). Too many files changed (100 lines over 58 files) for a change that isn't really a fix (the reason stated in C++ guidelines is 'readability', which is rather weak for a 58 file change IMO). I feel this is one of those things that can be fixed gradually over time as people update the transgressing code. |
|
Closing this PR due to lack of consensus ACK :-) |
Don't use zero as null pointer constant.
From the developer notes:
From the C++ Core Guidelines:
Found by compiling the project with
-Wzero-as-null-pointer-constantand fixing where appropriate (skipping false positives).