RFR: 8307959: Remove explicit type casts from SerializeClosure::do_xxx() calls

Matias Saavedra Silva matsaave at openjdk.org
Thu May 11 21:28:32 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'

Nice fix, LGTM

-------------

Marked as reviewed by matsaave (Committer).

PR Review: https://git.openjdk.org/jdk/pull/13941#pullrequestreview-1423458819


More information about the hotspot-dev mailing list