RFR: 8274400: HotSpot Style Guide should permit use of alignof [v2]
Kim Barrett
kbarrett at openjdk.org
Mon Dec 26 23:56:50 UTC 2022
On Mon, 26 Dec 2022 16:13:20 GMT, Julian Waters <jwaters at openjdk.org> wrote:
>> The alignof operator was added by C++11. It returns the alignment for the given type. Various metaprogramming usages exist, in particular when using std::aligned_storage. Use of this operator should be permitted in HotSpot code.
>
> Julian Waters has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>
> - More Descriptive Version
> - Merge remote-tracking branch 'upstream/master' into alignof
> - HotSpot Style Guide should permit use of alignof
doc/hotspot-style.md line 708:
> 706: operator in the development of the language and just returns the corresponding
> 707: `alignof` value, the operator simply provides less verbose syntax for doing so.
> 708: Newer code should prefer `alignof` to `std::alignment_of<>` if possible.
Some of this is extraneous, explaining what `alignof` does, which one can get
elsewhere. (We don't need to summarize/duplicate that information here.)
Something short and simple like this is sufficient:
Use of `alignof`
([n2341](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf))
is permitted. It should be used instead of `std::alignment_of<>`.
(We don't need to talk about "Newer code" - I'm pretty sure we have no uses of `std::alignment_of<>`
in HotSpot.)
-------------
PR: https://git.openjdk.org/jdk/pull/11761
More information about the hotspot-dev
mailing list