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

Consider adding non-[[nodiscard]] specializations of QtConcurrent::run which returns QFuture<void>

    XMLWordPrintable

Details

    • 1
    • c1a95d1d0 (dev), 47a028270 (dev), ba3225bab (6.5), a219503f1 (tqtc/lts-6.2), 14a2bd7ad (6.6), 7abb108f8 (tqtc/lts-5.15)
    • Foundation Sprint 87, Foundation Sprint 88

    Description

      Running a function returning void could often be a fire-and-forget scenario, or it may even emit signals later. So having QtConcurrent::run() marked nodiscard for all return-types means users must use Q_UNUSED (or its expanded from) to ignore the warning it produces.

      void doThing();
      ...
      QtConcurrent::run(doThing); // currently: warning of unused return value
      ...
      QFuture<void> future = QtConcurrent::run(doThing); // OK, but...
      Q_UNUSED(future); // ... it's unused
      

      Attachments

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

        Activity

          People

            mmutz Marc Mutz
            manordheim MÃ¥rten Nordheim
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: