Integrated: JDK-8255544: Create a checked cast

Andrew Haley aph at openjdk.java.net
Fri Jan 29 02:37:42 UTC 2021


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 pull request has now been integrated.

Changeset: 3302d3ad
Author:    Andrew Haley <aph at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/3302d3ad
Stats:     17 lines in 2 files changed: 16 ins; 0 del; 1 mod

8255544: Create a checked cast

Reviewed-by: adinn, iklam

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

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


More information about the hotspot-dev mailing list