Need reviewer for warning error fix on hprof_init.c
David Holmes
david.holmes at oracle.com
Sun Sep 16 15:50:50 PDT 2012
On 16/09/2012 2:33 AM, Dmitry Samersoff wrote:
> Kelly,
>
> Sorry for being later in a party.
>
> Function receiving port number as an argument should use *in_port_t* -
> rather than unsigned short - it expands to uint16_t or to uint32_t
> depending to OS.
But that change in itself may not fix the problem because it is a
comparison of a 16-bit type against a value that requires at least
17-bits that the compiler complains about.
David
> -Dmitry
>
> On 2012-09-15 19:58, Kelly O'Hair wrote:
>>
>> On Sep 15, 2012, at 4:10 AM, David Holmes wrote:
>>
>>> On 15/09/2012 11:52 AM, Kelly O'Hair wrote:
>>>>
>>>> 7198327: Fix mac warning error in hprof_init.c
>>>>
>>>> http://cr.openjdk.java.net/~ohair/openjdk8/repo-jdk/webrev/src/share/demo/jvmti/hprof/hprof_init.c.sdiff.html
>>>>
>>>> The Mac warns on the if test for the port number being> 65535
>>>> made more sense for the port to be a simple int.
>>>
>>> Seems simpler and more correct to just do:
>>>
>>> if (port == 0 || (int)port> 65535) {
>>
>>
>> If I can find a way to keep the cast count down, I tend to go that route.
>> I also know that compilers really don't pass 16bit quantities around, but 32bit quantities,
>> so in my mind, passing an int is simpler and might avoid some implicit casting.
>> I spent too many years working on compilers :^(
>>
>> Of course I could see that I should have made it an unsigned int.
>>
>>
>> So are you against this change?
>>
>> -kto
>>
>>>
>>> David
>>>
>>>> -kto
>>>>
>>
>
>
More information about the serviceability-dev
mailing list