Request for review: 8016302: Change type of the number of GC workers to unsigned int (2)
Stefan Karlsson
stefan.karlsson at oracle.com
Thu Apr 3 13:30:45 UTC 2014
On 2014-04-03 15:21, Thomas Schatzl wrote:
> 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 :)
We do use %u and %d.
Just some crude greping gives:
$ grep -r "%u" src/ | wc
303 2441 35578
$ grep -r "UINT32_FORMAT" src/ | wc
32 222 3589
$ grep -r "%d" src/ | wc
3118 23214 337084
$ grep -r "INT32_FORMAT" src/ | wc
71 517 7770
thanks,
StefanK
>
> Thomas
>
>
More information about the hotspot-gc-dev
mailing list