[Kde-pim] foreach and akonadi

David Faure faure at kde.org
Sun Apr 27 22:50:07 BST 2008


On Sunday 27 April 2008, Tom Albers wrote:
> Hi There,
> 
> Albert is verifying the usage of foreach in kde's repository and send me the following interesting mail and ask me to forward it to the list.
> 
> Toma
> 
> 
> Op zaterdag 26 april 2008 01:00 schreef Albert Astals Cid <aacid at kde.org>:
> > Doing my routine foreach cleanup i discovered a few places on akonadi where 
> > foreach is used to modify the contents of a list
> > 
> > Example:
> >     foreach ( Part part, parts ) {
> >       part.setData( QByteArray() );
> >       if ( !part.update() )
> >         qDebug() << "failed to update item part" << part.id();
> >     }

This is indeed a very good reason for always writing foreach(const Part& part, parts),
which will detect (and refuse) usage of non-const methods.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list