Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-32559

QByteArray(QByteArrayDataPtr dd) constructor warning C4946: reinterpret_cast used between related classes: 'QArrayData' and 'QTypedArrayData<T>'

    XMLWordPrintable

Details

    • 8fd3d53a93d50506a0c3fa620e560cf1b03ba3c0

    Description

      The inline QByteArray(QByteArrayDataPtr dd) constructor defined in QtCore/qbytearray.h does:

      reinterpret_cast<Data *>(dd.ptr)

      As you know, reinterpret_cast is a rather "brute force" way of casting. In this particular case, it may also cause a compiler warning, when using Visual C++:

      warning C4946: reinterpret_cast used between related classes: 'QArrayData' and 'QTypedArrayData<T>'

      So in this case, it seems more appropriate to do static_cast.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            niels_dekker Niels Dekker
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes