Request for review: 8016302: Change type of the number of GC workers to unsigned int (2)
Thomas Schatzl
thomas.schatzl at oracle.com
Thu Apr 3 13:21:39 UTC 2014
Hi,
On Thu, 2014-04-03 at 14:38 +0200, Stefan Karlsson wrote:
> On 2014-04-03 14:40, Thomas Schatzl wrote:
> > Hi,
> >
> > On Thu, 2014-04-03 at 15:41 +0400, Vladimir Kempik wrote:
> >> Hello
> >>
> >> I've used UINT32_FORMAT because:
> >>
> >> 1) previous format type for worker was INT32_FORMAT, when worker was int
> >>
> >> 2) there is no such thing as UINT_FORMAT, there is only UINTX_FORMAT
> >>
> >> Do you think UINTX_FORMAT is better than UINT32_FORMAT for this case ?
> > UINTX_FORMAT or uintx is an unsigned data type that has 32 or 64 bit
> > size depending on the processes' word size.
> >
> > I think UINT32_FORMAT is correct here, and used elsewhere for uint
> > variables. Afaik uint is 32 bits on all platforms we use.
>
> Why don't we just use %u?
looking through the code, UINT32_FORMAT expands to %u always.
I do not know why it is specifically called UINT*32*_FORMAT, and why
there is no UINT_FORMAT.
Also I do not know why we do not use %(d/i/u) for int/uint variables - I
assume for uniformity with types and format specifiers that change
depending on word size or compiler (e.g. uintx, size_t).
It may also just be that I am completely wrong, and we should %u for
uints - this opinion with UINT32_FORMAT was formed by looking at other
hotspot code, which is, as you know, not exactly the perfect example for
uniform code :)
Thomas
More information about the hotspot-gc-dev
mailing list