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

Florian Weimer fweimer at openjdk.org
Thu Oct 9 11:30:19 UTC 2025


On Thu, 9 Oct 2025 04:07:02 GMT, Kim Barrett <kbarrett 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
>
> Kim Barrett has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - jrose comments
>  - move tuple to undecided category

doc/hotspot-style.md line 567:

> 565: 
> 566: Functions that may throw exceptions must not be used.  This is in accordance
> 567: with the HotSpot policy of [not using exceptions](#error-handling).

In the GCC implementation, destructor registration may throw `__gnu_cxx::recursive_init_error` (via the `__cxa_guard_acquire` Itanium ABI function). Are global or static objects with non-trivial destructors permitted? I think there are a couple of such uses today.

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

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


More information about the hotspot-dev mailing list