RFR: 8357086: os::xxx functions returning memory size should return size_t [v13]

Anton Artemov duke at openjdk.org
Wed Jul 30 14:11:58 UTC 2025


On Tue, 29 Jul 2025 00:57:58 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> Maybe we should have an `ATTRIBUTE_NODISCARD` macro with an always empty
> definition, and add it to all the functions being changed? Otherwise, once
> `[[nodiscard]]` becomes available, someone is going to have to hunt down all
> the relevant functions. Once we have C++17 we can revisit. It might take some
> preliminary call-site fixes before we can change the macro (or more likely,
> remove it and just use `[[nodiscard]]` directly).

@kimbarrett How about to change the return type from bool to some enum class? They are not implicitly convertible to integers, so one should not be able to ignore the return value of a function then. And we will not need a `[[nodiscard]]` in this case.

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

PR Comment: https://git.openjdk.org/jdk/pull/25450#issuecomment-3136523519


More information about the hotspot-dev mailing list