[clazy] [Bug 410714] clazy-detaching-temporary: Don't warn on detaching pointer values

Sergio Martins bugzilla_noreply at kde.org
Thu Aug 8 20:23:21 BST 2019


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

--- Comment #3 from Sergio Martins <smartins at kde.org> ---
It's indeed safe, but the warning is not about safety, it's about an unneeded
QList copy when detaching a temporary.

The performance impact can vary from negligeable if the list is small and
detach called just a few times to high if the list is big and detached often.


Clazy can't know the size of the list nor does it know how often some method is
called (could even be called in a loop from another translation unit).


By using constFirst() instead of first() then we're certain that there's no
detach and there's no guessing needed in the first place.

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


More information about the Unassigned-bugs mailing list