[clazy] [Bug 385801] New: favor function taking or returning std::chrono types

bugzilla_noreply at kde.org bugzilla_noreply at kde.org
Mon Oct 16 09:21:44 BST 2017


https://bugs.kde.org/show_bug.cgi?id=385801

            Bug ID: 385801
           Summary: favor function taking or returning std::chrono types
           Product: clazy
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: unassigned-bugs at kde.org
          Reporter: eric.lemanissier at gmail.com
                CC: smartins at kde.org
  Target Milestone: ---

Some members function of Qt classes have one overload taking time as plain
integer, and another taking time as std::chrono::duration or
std::chrono::time_point. Plain integers are error prone, because the unit is
implicit, so one must refer to the doc to make sure there is no error. Clazy
could warn the usage of the plain integer overloads, and propose a fixit. 
in QTimer: setInterval, singleShot, start
in QDeadlineTimer: Constructor, operator=, setDeadline, setRemainingTime,
operator+, operator+=
in QMutex: tryLock can be replaced with try_lock_for or try_lock_until
QObject::startTimer

The other case which could be ambiguous is function returning integer, which
can be replaced with another returning a std::chrono::duration
in QTimer, interval can be replaced with intervalAsDuration. remainingTime can
be replaced with remainingTimeAsDuration
in QDeadLineTimer deadline can be replaced with templated deadline.
remainingTime and remainingTimeNSecs can be replaced with
remainingTimeAsDuration

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Unassigned-bugs mailing list