Need reviewer for warning error fix on hprof_init.c
Kelly O'Hair
kelly.ohair at oracle.com
Sat Sep 15 08:58:14 PDT 2012
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