RFR: 8369186: HotSpot Style Guide should permit some uses of the C++ Standard Library

Kim Barrett kbarrett at openjdk.org
Wed Oct 8 13:25:58 UTC 2025


On Wed, 8 Oct 2025 07:07:21 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> Please review this change to the HotSpot Style Guide to suggest that C++
>> Standard Library components may be used, after appropriate vetting and
>> discussion, rather than just a blanket "no, don't use it" with a few very
>> narrow exceptions. It provides some guidance on that vetting process and
>> the criteria to use, along with usage patterns.
>> 
>> In particular, it proposes that Standard Library headers should not be
>> included directly, but instead through HotSpot-provided wrapper headers. This
>> gives us a place to document usage, provide workarounds for platform issues in
>> a single place, and so on.
>> 
>> Such wrapper headers are provided by this PR for `<cstddef>`, `<limits>`, and
>> `<type_traits>`, along with updates to use them. I have a separate change for
>> `<new>` that I plan to propose later, under JDK-8369187. There will be
>> additional followups for other C compatibility headers besides `<cstddef>`.
>> 
>> This PR also cleans up some nomenclature issues around forbid vs exclude and
>> the like.
>> 
>> Testing: mach5 tier1-5, GHA sanity tests
>
> src/hotspot/share/utilities/tuple.hpp line 2:
> 
>> 1: /*
>> 2: * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
> 
> So we have our own tuple ...

We have our own baby partial tuple. What's there is more like a heterogeneous
array with compile-time indexing. It's used for one thing, and provides just
enough functionality for that use. I'm not entirely convinced it's the right
tool for the job, though I haven't taken the time to work out alternatives.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27601#discussion_r2413850653


More information about the hotspot-dev mailing list