RFR: 8369828: Generalize share/utilities/bytes.hpp [v2]
Kim Barrett
kbarrett at openjdk.org
Wed Oct 15 17:37:03 UTC 2025
On Wed, 15 Oct 2025 13:47:17 GMT, Justin King <jcking at openjdk.org> wrote:
>> src/hotspot/share/utilities/unalignedAccess.hpp line 53:
>>
>>> 51: static void store(void* ptr, T value) {
>>> 52: STATIC_ASSERT(std::is_trivially_copyable<T>::value);
>>> 53: STATIC_ASSERT(std::is_trivially_default_constructible<T>::value);
>>
>> I'm not seeing why we should care about trivially default-constructible here?
>
> This is more just for language correctness, in case somebody tries to use this with a class or struct that is non-trivial.
I agree the `std::is_trivially_copyable` test should be there.
It's the `std::is_trivially_default_constructible` test that I'm questioning. I don't see anything in this code
that has that as a requirement. So I find it confusing.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27801#discussion_r2433435457
More information about the hotspot-dev
mailing list