RFR: 8274400: HotSpot Style Guide should permit use of alignof
Julian Waters
jwaters at openjdk.org
Thu Dec 22 04:50:50 UTC 2022
On Thu, 22 Dec 2022 04:39:47 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.
I do have a more detailed writeup sitting around, but ultimately decided it was overkill for such a simple operator. I will leave it here for now though
### alignof
`alignof`
([n2341](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf))
is permitted alongside `alignas` for querying the alignment of a complete object
type, an array type with a complete element type, or a reference type to either as
an alternative to `std::alignment_of<>`. `std::alignment_of<>` precedes the
operator in the development of the language and just returns the corresponding
`alignof` value, the operator simply provides less verbose syntax for doing so.
-------------
PR: https://git.openjdk.org/jdk/pull/11761
More information about the hotspot-dev
mailing list