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

Markus bugzilla_noreply at kde.org
Thu Aug 8 14:17:26 BST 2019


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

--- Comment #2 from Markus <markus.haberlander.sw at gmail.com> ---
(In reply to Sergio Martins from comment #1)
> That QList is not a pointer
> 
> It's doing axes(Qt::Horizontal).first(), not axes(Qt::Horizontal)->first()

This is of course correct, sorry for being unclear in my description. 

I was referring to the contents of the QList - the QList contains pointers to
the axes, and it is safe and intended to manipulate these via the returned
temporary QList directly.

I reported this because it just didn't make sense to me to see a warning in
this case, for the following reasons: 
* The warning is specific to the call to QList::first(), which is likely to get
called on small lists. Here it's a case where typically only one item is
returned.
* If the list contents are pointers, it's not so expensive to have a detaching
copy, nor is it so problematic since the pointers in the list are still
pointing to valid objects.
* The warning is about a "detaching-temporary". This first made me think that
"axes(..).first()" points to a temporary and not the real pointee. But this is
not the case.
* It seems to be the suggested way to use the API of QChart ...

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


More information about the Unassigned-bugs mailing list