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

Thomas Stuefe stuefe at openjdk.org
Sat Aug 12 17:31:28 UTC 2023


On Sat, 12 Aug 2023 13:02:40 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/os/linux/os_linux.cpp line 3151:
>> 
>>> 3149:                            // are more reasonable) we'll just hardcode the number they use
>>> 3150:                            // in the library.
>>> 3151:   const int BitsPerCLong = (int)sizeof(long) * CHAR_BIT;
>> 
>> suggestion here and above: constexpr?
>
> ? They're already const .  Isn't that the same?

They are most const :-)

constexpr is for things that are compile-time const. The advantage is, apart from documentation, that the compiler checks your assumption about compile-time-constness. In this case, it probably does not matter much.

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

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


More information about the hotspot-dev mailing list