RFR: JDK-8255544: Create a checked cast

Andrew Dinn adinn at openjdk.java.net
Fri Oct 30 10:09:47 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.

This is great. All we need now is to get hotspot devs to use it :-)

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

Marked as reviewed by adinn (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/904


More information about the hotspot-dev mailing list