RFR: 8377895: Create sizeof_auto, to reduce narrowing conversions [v6]

Leo Korinth lkorinth at openjdk.org
Mon Feb 23 12:57:06 UTC 2026


On Thu, 19 Feb 2026 20:43:51 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Leo Korinth has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   suggestion from Kim
>
> src/hotspot/share/utilities/globalDefinitions.hpp line 189:
> 
>> 187: // Example of correct usage of sizeof/sizeof_auto:
>> 188: // size_t size = std::numeric_limits<uint32_t>::max() * sizeof(uint16_t); // this will wrap using sizeof_auto, use sizeof to ensure computation using size_t
>> 189: // int count = 42 / sizeof_auto(uint16_t);                                // implicit narrowing conversion or compiler warning/error using stricter compiler flags when using sizeof
> 
> Could you shorten these (very) long lines?  Just move the description of each snippet
> before the snippet, rather than as a same-line comment.

fixed

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29716#discussion_r2840716089


More information about the hotspot-dev mailing list