RFR: 8274400: HotSpot Style Guide should permit use of alignof [v3]
Julian Waters
jwaters at openjdk.org
Fri Dec 30 13:52:50 UTC 2022
On Fri, 30 Dec 2022 02:33:31 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> 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 five additional commits since the last revision:
>>
>> - Make section more brief
>> - Merge remote-tracking branch 'upstream/master' into alignof
>> - More Descriptive Version
>> - Merge remote-tracking branch 'upstream/master' into alignof
>> - HotSpot Style Guide should permit use of alignof
>
> doc/hotspot-style.md line 706:
>
>> 704: alternative to `std::alignment_of<>`. The template precedes the operator
>> 705: in the language, so `alignof` should be preferred to `std::alignment_of<>`
>> 706: if possible.
>
> `alignof` doesn't "check" anything. And this is still overly verbose. Keep it
> simple. I was going to suggest using this:
> "`alignof`(ref...) is permitted. Use `alignof` instead of `std::alignment_of<>`."
>
> But I think better is to add `alignof` to the "### Additional Permitted
> Features" list, and change the place where inclusion of `<type_traits>` is
> discussed, adding a restriction against using `std::alignment_of<>`. There one
> can justify the restriction by noting the trait class preceded the operator
> and provides the same functionality. We're probably going to want additional
> restrictions for `<type_traits>` because of
> https://bugs.openjdk.org/browse/JDK-8298399.
>
> So edit that section like so:
>
> * `#include <type_traits>` with restrictions (see below).
> ...
>
> Some definitions from `<type_traits>` should not be used.
> * `std::alignment_of<>` has been superseded by `alignof`, which should be used instead.
Will do, thanks
-------------
PR: https://git.openjdk.org/jdk/pull/11761
More information about the hotspot-dev
mailing list