[clazy] [Bug 367484] reserve-candidate warnings for QVarLengthArray

Sergio Martins via KDE Bugzilla bugzilla_noreply at kde.org
Fri Aug 19 15:44:14 BST 2016


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

Sergio Martins <smartins at kde.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |CONFIRMED

--- Comment #3 from Sergio Martins <smartins at kde.org> ---
(In reply to Mathias Hasselmann from comment #2)
> (In reply to Sergio Martins from comment #1)
> > Wouldn't a reserve make sense in that example ?
> Not at all. The purpose of QVarLengthArray is to save the reserve, or rather
> to do it right on the stack - therefore the pre-alloc parameter.

I usually use QVarLengthArray::reserve() anyway, since QVLA will use the heap
when bigger than preallocSize. reserve(X) is a NO-OP for the cases where X <=
preallocSize, so there's no harm.

But I understand the warning is annoying for you, since it's all using compile
time constants so there's no chance of spilling onto the heap.

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



More information about the Unassigned-bugs mailing list