RFR: 8377895: Create sizeof_auto, to reduce narrowing conversions [v2]

Leo Korinth lkorinth at openjdk.org
Mon Feb 16 14:46:31 UTC 2026


On Mon, 16 Feb 2026 09:32:53 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> I think I understand this feature, a `sizeof` returning the smallest integer type. Can `checked_cast` be used to reduce conversion warning instead?

`checked_cast` has at least three problems:

1) it is checked at runtime, not compile time. 
2) it is checked only on debug builds
3)  you need to use it, it will make the code harder to read, it is easier to use `sizeof_auto`

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

PR Comment: https://git.openjdk.org/jdk/pull/29716#issuecomment-3908866088


More information about the hotspot-dev mailing list