RFR: 8357086: os::xxx functions returning memory size should return size_t [v11]
Thomas Stuefe
stuefe at openjdk.org
Wed Jun 18 09:25:34 UTC 2025
On Tue, 17 Jun 2025 09:15:51 GMT, Anton Artemov <duke at openjdk.org> wrote:
> Okay, let me summarize the findings:
>
>
>
> 1) One needs to be consistent with respect to the type of the return value, of `os::xxx()` and having `size_t` in all methods is something everyone agrees on.
>
> 2) There is a consensus that errors should be reported and handled properly, not ignored.
>
> 3) There is only one type of error.
>
> 4) The usage pattern should make it difficult for the user to ignore the error if it is reported.
>
>
>
> Given the above, I think the optimal solution is to have a boolean as a return type to indicate the error (true for no error, false for error), and the actual memory value as an in-parameter transferred by reference or pointer. The usage pattern may be enforced by `[[nodiscard]]` attribute, but it available from C++17 only. For now, one can just add if/else statements, and add the attribute later after upgrade to C++17.
+1 on all points. Thanks a lotä for doing this, I know bikesheddy issues like this can be a real slog.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25450#issuecomment-2983387064
More information about the hotspot-dev
mailing list