RFR: 8292981: Unify and restructure integer printing format specifiers [v4]
Coleen Phillimore
coleenp at openjdk.org
Tue Aug 30 16:03:08 UTC 2022
On Tue, 30 Aug 2022 14:18:37 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
>> src/hotspot/share/utilities/globalDefinitions.hpp line 110:
>>
>>> 108: // Format 16-bit quantities.
>>> 109: #define INT16_FORMAT_X_0 "0x%04" PRIx16
>>> 110: #define UINT16_FORMAT_X_0 "0x%04" PRIx16
>>
>> I'm confused. What's the trailing 0 ? is it to print the "0x" part of the hex format? And why wouldn't you want that?
>
> I tried to describe it above:
>
> // _X - print as hexadecimal, without leading 0s: 0x12345
> // _X_0 - print as hexadecimal, with leading 0s: 0x00012345
>
>
> It's about padding with 0s. So, that you get 0x00012345 instead of 0x12345. Do you have a suggestion on how to write that comment any clearer?
I see that now. I wandered into the diffs to quickly see what this is about and saw this without the comment and it looked strange. Maybe _0X would also look strange, or even _0_X. I assume these alternatives have been discussed and discarded.
-------------
PR: https://git.openjdk.org/jdk/pull/10042
More information about the hotspot-dev
mailing list