<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 22, 2020 at 2:38 PM Steve Scalpone via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Me? I would modify the first sentence from:<br>
<br>
> When writing the body of an if, else, or loop statement,<br>
> omit the braces to avoid unnecessary line noise. However,<br>
> braces should be used in cases where the omission of braces<br>
> harm the readability and maintainability of the code.<br>
<br>
To be:<br>
<br>
> Braces are optional around the body of an if, else, or loop statement,<br>
> except in cases where the omission of braces harm the readability and<br>
> maintainability of the code.<br></blockquote><div><br></div><div>The current wording is more clear as it expresses unambiguously the preferred way of formatting the code. I don't see a benefit to this change of phrasing (on the opposite, I prefer less ambiguous).</div><div><br></div><div>-- </div><div>Mehdi</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
Followed by the rest of the section that describes cases where readability or maintainability would be harmed.<br>
<br>
And then be done with it.<br>
<br>
- Steve<br>
<br>
On 6/22/20, 1:44 PM, "Chris Lattner" <<a href="mailto:clattner@nondot.org" target="_blank">clattner@nondot.org</a>> wrote:<br>
<br>
External email: Use caution opening links or attachments<br>
<br>
<br>
For those who don’t like it, is the currently documented policy broken enough to be important to changing?<br>
<br>
I assume you wouldn’t recommend a massive rewrite of the codebase, so we’re going to be with this for quite some time.<br>
<br>
-Chris<br>
<br>
> On Jun 22, 2020, at 1:36 PM, Steve Scalpone via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
> Did this conversation reach a conclusion?<br>
><br>
> My ad hoc tally says that a slight majority of the responders preferred to fully brace statements and no one wanted to totally eliminate braces.<br>
><br>
> The technical arguments for fully braced statements were 1) it's considered a slightly safer coding style and 2) commit diffs with fully braced statements may be slightly more to the point.<br>
><br>
> I didn't register any technical arguments for less-than-fully-braced statement -- the preference seemed to be aesthetic. I may have missed a technical argument.<br>
><br>
> Certainly an "always use braces" rule would be simpler than what's documented now in the LLVM Coding Standards [1].<br>
><br>
> Another option would be to make braces a developer's choice, and ask that those omitting braces please follow the rules documented in [1].<br>
><br>
> [1] <a href="https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements" rel="noreferrer" target="_blank">https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements</a><br>
><br>
> On 6/18/20, 3:56 AM, "llvm-dev on behalf of Nicolai Hähnle via llvm-dev" <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a> on behalf of <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
> External email: Use caution opening links or attachments<br>
><br>
><br>
> On Tue, Jun 16, 2020 at 10:35 AM Momchil Velikov via llvm-dev<br>
> <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>> My 2 pennies is braces add unnecessary clutter and impair readability when<br>
>> used on a *single-line* statement. I count comments, that are on their<br>
>> own line as statement(s).<br>
><br>
> +1 for this. I think braces around single-line statements can be<br>
> allowed, but they really shouldn't be mandated, and that's been my<br>
> personal policy for reviews. In particular,<br>
><br>
> if (!is_transform_applicable) {<br>
> return {};<br>
> }<br>
><br>
> is very aggravating clutter.<br>
><br>
> Braces should be required around multi-line statements. Note:<br>
><br>
> BAD:<br>
> for (...)<br>
> for (...)<br>
> single_line_statement;<br>
><br>
> GOOD:<br>
> for (...) {<br>
> for (...)<br>
> single_line_statement;<br>
> }<br>
><br>
> Cheers,<br>
> Nicolai<br>
> --<br>
> Lerne, wie die Welt wirklich ist,<br>
> aber vergiss niemals, wie sie sein sollte.<br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>