RFR: 8337683: Fix -Wconversion problem with arrayOop.hpp [v5]
Coleen Phillimore
coleenp at openjdk.org
Thu Aug 8 20:12:35 UTC 2024
On Thu, 8 Aug 2024 19:30:37 GMT, Dean Long <dlong at openjdk.org> wrote:
>> Because restricting the types is better than checked_cast. The return type of length_offset_in_bytes() is int.
>
> Also I think the current checked_cast still has problems with signed <--> unsigned.
>
> Another technique to use an even more restricted type. For example, if these offset_in_bytes() functions returned uint16_t, then the value can be widened to either `int` or `size_t` without a cast.
Yes that would be a change that we could make that would help, and these offset_in_bytes functions should return an unsigned type since they're never negative.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20431#discussion_r1710215749
More information about the hotspot-dev
mailing list