-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8327173: HotSpot Style Guide needs update regarding nullptr vs NULL #18101
Conversation
👋 Welcome back kbarrett! A progress list of the required criteria for merging this PR into |
@kimbarrett The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
doc/hotspot-style.md
Outdated
([n2431](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf)) | ||
to `NULL`. Don't use (constexpr or literal) 0 for pointers. | ||
rather than `NULL`. Don't use (constant expression or literal) 0 for pointers. |
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 there be any discussion here of why we want to avoid NULL
? Specifically the varying
definitions and the pitfalls of NULL
in varargs context. Also template and overload issues.
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 it would be enough to write 1..2 sentences about this, and then defer to N2431 already linked here for more details.
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 agree with Aleksey.
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.
Good point. I decided just referring to the paper for rationale is sufficient.
Webrevs
|
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 okay, but questions/suggestions:
doc/hotspot-style.md
Outdated
([n2431](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf)) | ||
to `NULL`. Don't use (constexpr or literal) 0 for pointers. | ||
rather than `NULL`. Don't use (constant expression or literal) 0 for pointers. |
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 it would be enough to write 1..2 sentences about this, and then defer to N2431 already linked here for more details.
doc/hotspot-style.md
Outdated
The C++11 definition of _null pointer constant_ included integral constant | ||
expressions with value zero. C++14 replaced that with integer literals with | ||
value zero. Some compilers continue to treat a zero-valued integral constant | ||
expressions as a _null pointer constant_ even in C++14 mode. |
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.
It is not very clear why should this concern any Hotspot developers?
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.
If one is familiar with C++14 (or later) or were to look up null pointer
constant in the C++14 standard, one might wonder why this style guide
admonishes against using non-literal constant expressions for such. But I've
rewritten the part about 0 as a pointer to (I think) make things clearer.
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.
Current revised text looks good to me.
Thanks
@kimbarrett This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
I just discovered gcc |
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.
Approved.
Thanks for reviews @vnkozlov , @kimbarrett , and @dholmes-ora . |
/integrate |
Going to push as commit 3d37b28. |
@kimbarrett Pushed as commit 3d37b28. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Please review this change to update the HotSpot Style Guide's discussion of
nullptr and its use.
I suggest this is an editorial rather than substantive change to the style
guide. As such, the normal HotSpot PR process can be used for this change.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18101/head:pull/18101
$ git checkout pull/18101
Update a local copy of the PR:
$ git checkout pull/18101
$ git pull https://git.openjdk.org/jdk.git pull/18101/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18101
View PR using the GUI difftool:
$ git pr show -t 18101
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18101.diff
Webrev
Link to Webrev Comment