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

Leo Korinth lkorinth at openjdk.org
Mon Feb 23 13:25:40 UTC 2026


On Sun, 22 Feb 2026 11:00:11 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> Leo Korinth has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Line break comments, and add compiler error code on Windows to comment
>
> src/hotspot/share/utilities/globalDefinitions.hpp line 179:
> 
>> 177:         std::conditional_t<N <= std::numeric_limits<uint32_t>::max(), uint32_t, uint64_t>>>;
>> 178:   return static_cast<unsigned_auto>(N);
>> 179: }
> 
> If I may butt in... This function has nothing to do with `sizeof`, so its name should not contain "sizeof". Its current name is misleading.
> This function is of general use, so much so that it perhaps could even be part of the standard C++ language. `auto_size()` is not a bad choice of name for such a function.

I agree that the template is more general than what the name implies. I think the current name is not misleading at all. I will change it if you can create a name that Kim approves.

I propose that we leave the renaming to the next user of the method.

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

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


More information about the hotspot-dev mailing list