RFR: 8314114: Fix -Wconversion warnings in os code, primarily linux [v2]

Thomas Stuefe stuefe at openjdk.org
Fri Aug 11 16:11:28 UTC 2023


On Fri, 11 Aug 2023 12:03:01 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/os/linux/os_linux.cpp line 426:
>> 
>>> 424: 
>>> 425: void os::Linux::initialize_system_info() {
>>> 426:   set_processor_count(checked_cast<int>(sysconf(_SC_NPROCESSORS_CONF)));
>> 
>> checked_cast seems excessive here and on other sysconf calls.
>
> One of you wants checked_cast<> everywhere and another of you doesn't.  Given that we don't know from local code inspection that the result fits in an int, I chose checked_cast<> for these calls.

What are the costs of checked_cast?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15229#discussion_r1291531511


More information about the hotspot-dev mailing list