<div class="gmail_quote">On Thu, Feb 9, 2012 at 6:17 AM, Dmitri Gribenko <span dir="ltr"><<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello Chandler,<br>
<br>
Thank you for the review!<br>
<br>
On Thu, Feb 9, 2012 at 11:50 AM, Chandler Carruth <<a href="mailto:chandlerc@google.com">chandlerc@google.com</a>> wrote:<br>
> I think there should be two ways to silence this warning:<br>
><br>
> 1) place the semicolon for the empty statement on its own line, or<br>
> 2) use empty curly braces.<br>
<br>
(1) always works, (2) doesn't work only with range-based for.<br>
<br>
> Secondly, we shouldn't warn on all range-based for loops: they can have<br>
> side-effects the same as for-loops. I think for consistency they should use<br>
> the same rules for silencing the warning.<br>
<br>
I agree that range-based for loops technically can be used only for<br>
side-effects, but that is only possible when iterator's operator++ or<br>
operator!= have side-effects.<br></blockquote><div><br></div><div>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.</div>
<div><br></div><div>for (WorkerThreadHandle wth : thingsToProcess) {}</div><div><br></div><div>In any case, using different rules for a ';' on its own line versus '{}' seems questionable.</div><div><br></div>
<div>- Richard</div></div>