<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Jan 16, 2013, at 2:06 , Chandler Carruth <<a href="mailto:chandlerc@google.com">chandlerc@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_default" style="">On Mon, Jan 14, 2013 at 8:44 AM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank" class="cremed">thakis@chromium.org</a>></span> wrote:<br>
</div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Mon, Jan 14, 2013 at 8:24 AM, Daniel Jasper <<a href="mailto:djasper@google.com" class="cremed">djasper@google.com</a>> wrote:<br>
> Author: djasper<br>
> Date: Mon Jan 14 10:24:39 2013<br>
> New Revision: 172431<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=172431&view=rev" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project?rev=172431&view=rev</a><br>
> Log:<br>
> Make single-line if statements optional.<br>
<br>
</div>Thanks!<br>
<br>
Out of curiosity, do you know how common this style is in Google's<br>
internal code? I haven't seen it much.<br></blockquote><div><br></div><div style="">For what it's worth, despite having written a lot of single-line if statements, I don't think this is worth options in the formatter. I think consistency and simplicity should trump here, and since there trivially exist cases that can't be on a single line, it seems of very low value to support folding onto a single line....</div>
<div style=""><br></div><div style="">My two cents, and it applies both to Google's internal coding style, and my feelings on LLVM's coding style.</div></div></div></div></blockquote><br></div><div>This is pure opinion, but I actually prefer single-line if statements if the braces are omitted. It makes it clearer to me that you can't add anything to the consequent clause.</div><div><br></div><div>(I agree that this is not the dominant style in LLVM though, or at least not in Clang.)</div><div><br></div><div>This may eventually be subsumed by a setting to add braces to single-statement if-statement.</div><div><br></div><div>Jordan</div><br></body></html>