Review Request: some krazy (and cppcheck) cleanups

Andrew Coles andrew_coles at yahoo.co.uk
Sat Dec 5 22:53:55 GMT 2009


-----------------------------------------------------------
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
> 
>





More information about the kde-core-devel mailing list