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

Consider making QDebug move-only come Qt 7

    XMLWordPrintable

Details

    • User Story
    • Resolution: Unresolved
    • P3: Somewhat important
    • 7.0 (Next Major Release)
    • None
    • Core: I/O
    • None
    • 21
    • Foundation PM Staging

    Description

      Traditionally, QDebug has been copyable¹, with the Stream (non-atomically) ref-counted. We should consider making QDebug move-only in order to get rid of the ref-counting. The problem is that your usual d << val1 then won't work anymore, because d (having a name) is an lvalue (you need to say d = std::move(d) << val instead). This is really only a problem for op<< implementations, your usual qDebug() << ... user chain is unaffected (except for smaller executable code size).

      ¹ mainly to facilitate passing it into and out of streaming operators, which cannot use pass-by-(lvalue-)reference, because qDebug() return an (r)value, which doesn't bind to lvalue references.

      Maybe we can at least create an opt-in and make sure all of our code never copies. While we won't get rid of ref-counting that way, we can at least get rid of the code upping and downing it, for our implementations, and so make ref > 1 [[unlikely]].

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            mmutz Marc Mutz
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes