Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8299688

Adopt C++14 compatible std::bit_cast introduced in C++20

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • tbd
    • 21
    • hotspot

      Hotspot currently has many places using C style casts, static_cast, or reinterpret_cast to convert between representations without changing the underlying bit representation.

      C++20 introduced std::bit_cast for this purpose and it is well defined. It is actually possible to implement bit_cast for C++14, without some constexpr support.

      This feature request is to refactor PrimitiveConversions::cast to bit_cast, expand bit_cast to support all compatible types, and use __builtin_bit_cast where available while falling back to the original implementations in PrimitiveConversions::cast. It then will replace some legacy conversion techniques with bit_cast.

            jcking Justin King
            jcking Justin King
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: