RFR: 8374445: Fix -Wzero-as-null-pointer-constant warnings in JfrSet [v2]
Markus Grönlund
mgronlun at openjdk.org
Thu Jan 15 17:12:41 UTC 2026
On Thu, 15 Jan 2026 16:15:52 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> src/hotspot/share/jfr/utilities/jfrSet.hpp line 72:
>>
>>> 70: }
>>> 71: for (unsigned i = 0; i < table_size; ++i) {
>>> 72: ::new (&table[i]) K{};
>>
>> Is this the new (placement pun intended) way to do a placement new, using the outer scope operator ::? Or is it because we don't know what Hotspot type this is?
>
> It's the same old way one should always do it. If one wants global placement
> new, one should say so. An unqualified `new` expression does a class-based
> lookup of `operator new`, so if the class has one (and lots of ours do), that
> will be used. We don't want that here, regardless of the type of `K`. As it
> happens, for all current uses `K` is a fundamental type, so it doesn't matter.
> But it's clearer and future proof to be explicit.
And the new location for global new is cppstdlib/new.hpp - ok.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29022#discussion_r2695233003
More information about the hotspot-jfr-dev
mailing list