Bug 392914

Summary: False positive for check "reserve-candidates" in case of if else statement.
Product: [Developer tools] clazy Reporter: Roman <dismine>
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED WORKSFORME    
Severity: normal CC: smartins
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Roman 2018-04-09 08:01:12 UTC
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.
Comment 1 Justin Zobel 2022-11-18 04:30:25 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 2 Bug Janitor Service 2022-12-03 05:18:31 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Bug Janitor Service 2022-12-18 05:16:32 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!