[clazy] [Bug 392914] New: False positive for check "reserve-candidates" in case of if else statement.
Roman
bugzilla_noreply at kde.org
Mon Apr 9 09:01:12 BST 2018
https://bugs.kde.org/show_bug.cgi?id=392914
Bug ID: 392914
Summary: False positive for check "reserve-candidates" in case
of if else statement.
Product: clazy
Version: unspecified
Platform: Other
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: NOR
Component: general
Assignee: unassigned-bugs at kde.org
Reporter: dismine at gmail.com
CC: smartins at kde.org
Target Milestone: ---
Here is an example of code:
QList<int> people_ages;
QList<int> ages;
// ages.reserve(people_ages.size());
int i = rand() % 10;
if (i == 2)
{
ages.reserve(people_ages.size());
for (auto age : people_ages)
ages << age;
}
else
{
for (auto age : people_ages)
ages << age;
}
Clazy correctly warns about reverse candidate case. But in my case i use a
container inside of if else statement. Adding reverse only in one branch silent
check for another branch.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Unassigned-bugs
mailing list