-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Replace 0 with nullptr where appropriate #1250
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
| if (GetFileAttributesExW(_Fname, GetFileExInfoStandard, &_Data)) { | ||
| // get file type and return permissions | ||
| if (_Pmode != 0) { | ||
| if (_Pmode != 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.
Should we use conversion to bool here, aka if (_Pmode)?
Would apply throughout
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.
Our codebase is currently inconsistent about testing pointers directly (or negated), versus comparing them to nullptr. (Unlike integers, where we strongly prefer to explicitly compare them against zero.) I personally like directly testing pointers, because I believe it reads naturally ("if we have pointer, do cool things with it") and avoids the double negation inherent in "not null". However, I think that if we want to consistently test pointers directly, we should do so as a separate cleanup change.
StephanTLavavej
left a comment
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.
Looks good, thanks! I think this will be ready to check in after making clang-format happy, and changing the _CRT_APP codepath for symmetry (this is not currently built in the GitHub repo but will be in the future).
|
Thanks for the cleanup! |
These were found with clang.