RFR: 8292981: Unify and restructure integer printing format specifiers [v4]

Coleen Phillimore coleenp at openjdk.org
Tue Aug 30 23:00:55 UTC 2022


On Tue, 30 Aug 2022 20:03:26 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> I don't have a strong opinion, just offering a couple ideas.  I'm not sure the additional underscore between the modifiers is worthwhile.  I like having the "X" before the extension part.  I thought about "Z" (for zero) instead of "0", but think I prefer being more literal.  So my preference would be "XXX_FORMAT_X0" instead of "XXX_FORMAT_X_0".  But that's a pretty weak preference.
>
> An alternative could be to switch so that _X means 0x and zero padding, and then use another letter to denote the case where we don't want the leading zeros.

INTPTR_FORMAT zero pads, right? and that seems to be more prevalent in the code.  So THING_FORMAT_X seems like it should also pad since that's usually(?) what we want.  So I like this idea.  Then thinking of a way to say not to pad is hard - how about THING_FORMAT_X_NZ (NZ for no zero).  Are there a lot of these?
Sorry for the drive by comments. If other people are fine, I'm okay with the names. I was just a bit surprised by the trailing zero on first read.

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

PR: https://git.openjdk.org/jdk/pull/10042


More information about the hotspot-dev mailing list