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-b...@kde.org
          Reporter: dism...@gmail.com
                CC: smart...@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 watching all bug changes.

Reply via email to