Code review comment for lp:~osomon/unity-2d/custom-quicklists-static

Revision history for this message
Florian Boucault (fboucault) wrote :

> > The use of a reverse for loop does not seem necessary. A forward one would
> be
> > simpler. And even better would be to use a Q_FOREACH.
>
> It *is* necessary because in this loop we are potentially removing the current
> action from the list, thus invalidating greater indexes. Iterating backward
> ensures the current index is always valid without having to resort to complex
> arithmetics.

I had not seen that.
Q_FOREACH would still work in that case because it operates on a copy of the list as soon as it is modified I believe.

« Back to merge proposal