On Thu, Feb 9, 2012 at 6:17 AM, Dmitri Gribenko <[email protected]> wrote:
> Hello Chandler, > > Thank you for the review! > > On Thu, Feb 9, 2012 at 11:50 AM, Chandler Carruth <[email protected]> > wrote: > > I think there should be two ways to silence this warning: > > > > 1) place the semicolon for the empty statement on its own line, or > > 2) use empty curly braces. > > (1) always works, (2) doesn't work only with range-based for. > > > Secondly, we shouldn't warn on all range-based for loops: they can have > > side-effects the same as for-loops. I think for consistency they should > use > > the same rules for silencing the warning. > > I agree that range-based for loops technically can be used only for > side-effects, but that is only possible when iterator's operator++ or > operator!= have side-effects. > That's not quite true. operator* could have a side-effect. begin/end could have a side-effect. And significantly, the construction of the iteration variable could have a side-effect. for (WorkerThreadHandle wth : thingsToProcess) {} In any case, using different rules for a ';' on its own line versus '{}' seems questionable. - Richard
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
