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

QString(View)::mid(int pos, int n): unspecified for pos < 0

    XMLWordPrintable

Details

    Description

      While for QString(View)::left() we have

      The entire string is returned if n is greater than or equal to size(), or less than zero.

      for QString(View)::nid() there is iust one of the out-of-bounds position cases defined:

      Returns a null string if the position index exceeds the length of the string.

      Given that https://doc.qt.io/qt-5/qstringview.html#mid explicitly states

      Until 5.15.1, the behavior was undefined when start < 0 or start > size(). Since 5.15.2, the behavior is compatible with QString::mid().

      one is even more puzzled, as one now knows behaviour is compatible, but still undefined?

      Wanted:
      explicit definition of behaviour, so it could be taken into account for special handling in own code.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            kossebau Friedrich W. H. Kossebau
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes