RFR: 8319242: HotSpot Style Guide should discourage non-local variables with non-trivial initialization or destruction
Manuel Hässig
mhaessig at openjdk.org
Mon Jun 16 07:01:47 UTC 2025
On Sun, 15 Jun 2025 05:15:11 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
> Please review this change to the HotSpot Style Guide to add discussion of how
> we prefer to handle initialization and destruction of non-local variables.
>
> I propose this is an editorial change, as it just documents current practice
> rather than suggesting a change to current practice. As such, the normal
> HotSpot PR process applies.
>
> The updated .html file was generated using make update-build-docs.
Thank you for working on this. I only have a suggestion that might help people who are less experienced.
doc/hotspot-style.html line 802:
> 800: <p>Avoid variables with static storage duration and non-constant
> 801: initialization, or with non-trivial destruction. Such variables can lead
> 802: to the so-called "static initialization order fiasco", or its dual on
Suggestion:
to the so-called <a href="https://isocpp.org/wiki/faq/ctors#static-init-order">
"static initialization order fiasco"</a>, or its dual on
I did not know what this is off the top of my head so a link might be helpful.
-------------
PR Review: https://git.openjdk.org/jdk/pull/25812#pullrequestreview-2930824226
PR Review Comment: https://git.openjdk.org/jdk/pull/25812#discussion_r2149168064
More information about the hotspot-dev
mailing list