RFR: JDK-8255544: Create a checked cast
Ioi Lam
iklam at openjdk.java.net
Sat Oct 31 03:17:56 UTC 2020
On Wed, 28 Oct 2020 15:50:52 GMT, Andrew Haley <aph at openjdk.org> wrote:
> In many places we've added C-style casts to silence compiler warnings, for example when truncating a size_t to an int when we know the size_t is a small struct. Such casts are inherently risky, because they effectively disable useful compiler warnings. We should add a form of cast that checks at runtime that a truncation does not overflow.
Can we change one place in HotSpot to use this function (preferably in a frequently-used code path), to verity that it really works?
-------------
Changes requested by iklam (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/904
More information about the hotspot-dev
mailing list