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
  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)
    for (auto age : people_ages)
        ages << age;
    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