[clazy] [Bug 354138] New: new check: Warn when using functions calls in for condition

Sergio Martins via KDE Bugzilla bugzilla_noreply at kde.org
Tue Oct 20 19:17:08 BST 2015


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

            Bug ID: 354138
           Summary: new check: Warn when using functions calls in for
                    condition
           Product: clazy
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: wishlist
          Priority: NOR
         Component: general
          Assignee: unassigned-bugs at kde.org
          Reporter: smartins at kde.org

for (int i = 0; i < foo.count(); ++i)

It's generally faster to do:
int count = foo.count()
for (int i = 0; i < count; ++i)

Maybe we could have this check only for containers, and optionally for all
functions, because sometimes there are expensive functions.

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



More information about the Unassigned-bugs mailing list