RFR: 8274400: HotSpot Style Guide should permit use of alignof [v4]

Kim Barrett kbarrett at openjdk.org
Sat Dec 31 04:22:52 UTC 2022


On Fri, 30 Dec 2022 13:59:13 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 seven additional commits since the last revision:
> 
>  - <type_traits>
>  - Merge remote-tracking branch 'upstream/master' into alignof
>  - 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

Changes requested by kbarrett (Reviewer).

doc/hotspot-style.md line 575:

> 573: * `#include <new>` to use placement `new`, `std::nothrow`, and `std::nothrow_t`.
> 574: * `#include <limits>` to use `std::numeric_limits`.
> 575: * `#include <type_traits>` with some considerations, listed below.

s/considerations/restrictions/

doc/hotspot-style.md line 578:

> 576: * `#include <cstddef>` to use `std::nullptr_t` and `std::max_align_t`.
> 577: 
> 578: Certain declarations from `<type_traits>` should be avoided.

s/should be avoided/are forbidden/

doc/hotspot-style.md line 581:

> 579: 
> 580: * `std::alignment_of<>` has been superseded by `alignof`, and the newer
> 581: operator should be preferred over it instead, whenever possible.

No need for weasel words like "whenever possible".  Simply

* `std::alignment_of<>`. It has been superseded by `alignof` expressions.

-------------

PR: https://git.openjdk.org/jdk/pull/11761


More information about the hotspot-dev mailing list