RFR: 8307959: Remove explicit type casts from SerializeClosure::do_xxx() calls
Calvin Cheung
ccheung at openjdk.org
Mon May 15 06:51:43 UTC 2023
On Thu, 11 May 2023 20:01:17 GMT, Ioi Lam <iklam at openjdk.org> wrote:
> Remove ugly type casts like:
>
>
> soc->do_ptr((void**)&_index);
> soc->do_u4((u4*)(&_shared_strings_array_root_index));
>
>
> =>
>
>
> soc->do_ptr((void**)&_index);
> soc->do_int(&_shared_strings_array_root_index);
>
>
> This is cleaner and also can catch invalid usage:
>
>
> long long x;
> soc->do_ptr((void**)&_x); // old style: no error from c++ compiler
> soc->do_ptr(&_x); // new style: "mismatched types 'T*' and 'long long int'
Looks like a good cleanup.
-------------
Marked as reviewed by ccheung (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/13941#pullrequestreview-1425866455
More information about the hotspot-dev
mailing list