RFR: JDK-8255544: Create a checked cast [v2]

Andrew Haley aph at openjdk.java.net
Sat Oct 31 14:02:07 UTC 2020


> 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.

Andrew Haley has updated the pull request incrementally with one additional commit since the last revision:

  JDK-8255544: Create a checked cast

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/904/files
  - new: https://git.openjdk.java.net/jdk/pull/904/files/5f8c47da..a3c9516e

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=904&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=904&range=00-01

  Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/904.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/904/head:pull/904

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


More information about the hotspot-dev mailing list