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

Avoid the common qMin/qMax errors when having qreal as floats

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • 6.0.0
    • 5.11.1
    • Core: Other
    • None

    Description

      When building qt applications with qreal being floats you almost always run into compiler errors with qMax/qMin being called with double/float or v.s. This is also the case for the Qt code base itself ( see QTBUG-69573 ).

      This type of problem could be avoided in general by introducing special versions of qMin/qMax - something like this:

      inline qreal qMin( float v1, double v2 )  {  return qMin( double( v1 ), v2 ); }

      inline qreal qMin( double v1, float v2 ) { return qMin( v1, double( v2 ) ); }

      ...

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            uwe Uwe Rathmann
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes