[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Review Request: some krazy (and cppcheck) cleanups
From:       "Andrew Coles" <andrew_coles () yahoo ! co ! uk>
Date:       2009-12-05 22:53:55
Message-ID: 20091205225355.25775.86528 () localhost
[Download RAW message or body]


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/2321/#review3381
-----------------------------------------------------------


Whilst you're changing loops based on iterators, it's better to cache the value of \
foo.end() in a const variable before the start of the loop:

{
  std::list<int>::iterator itr = numbers.begin();
  const std::list<int>::iterator itrEnd = numbers.end();

  for (; itr != itrEnd; ++itr) {
  ...
  }
}

(Note the extra braces - that way the scope of the iterator variables is still \
limited to just the for loop.)

- Andrew


On 2009-12-04 22:43:19, Jaime Torres wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/2321/
> -----------------------------------------------------------
> 
> (Updated 2009-12-04 22:43:19)
> 
> 
> Review request for kdelibs.
> 
> 
> Summary
> -------
> 
> c++ style casts
> ++c increments
> variable initializations
> variable scope
> (The red spaces are already removed from my local copy).
> 
> 
> Diffs
> -----
> 
> /trunk/kdesupport/strigi/src/streamanalyzer/fieldpropertiesdb.cpp 1058674 
> /trunk/kdesupport/strigi/src/streams/zipinputstream.cpp 1058674 
> /trunk/kdesupport/strigi/src/strigicmd/strigicmd.cpp 1058674 
> /trunk/kdesupport/strigi/src/xmlindexer/rdfindexer.cpp 1058674 
> /trunk/kdesupport/strigi/src/xsd/example.cpp 1058674 
> /trunk/kdesupport/strigi/src/xsd/metadataproperties.cpp 1058674 
> /trunk/kdesupport/strigi/src/xsd/strigidaemonconfiguration.cpp 1058674 
> 
> Diff: http://reviewboard.kde.org/r/2321/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jaime
> 
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic