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

Thomas Stuefe stuefe at openjdk.org
Fri Aug 11 18:07:29 UTC 2023


On Fri, 11 Aug 2023 17:45:20 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Yes, both literals are easily represented as an int, since the buffer we give to error reporting is never 30k long.
>
> Sorry, I don't like this, nor do I understand what this solves.
> 
> `size_t` is, by a deeply ingrained convention, used for memory sizes. It signals that intent clearly to the casual reader of the function declaration. `int` as size for an output buffer is away from conventions and just reads odd. Now this change perforates through all callers up to vmError and other call sites and just makes them all slightly worse, and it is pretty invasive (wrt merging changes to downports).

I just read the other comment as well. Hats off to your pain tolerance, Coleen, I don't aim to belittle your work. I'm just really unhappy with these size_t->int changes. 

Is there really no better way to solve this? This seems to be an example where solving warnings actually makes the code base worse. Coding against conventions makes the code base brittle (because experienced developers will always use size_t and fall over this).

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

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


More information about the hotspot-dev mailing list