jdoerfert added a comment.

Thanks for finally writing this down :) Two minor comments.



================
Comment at: llvm/docs/CodingStandards.rst:1580
+statement is accompanied by a comment that loses its meaning if hoisted above 
the if
+or loop statement, or where the single statement is complex enough that it 
stops being
+clear that it is a single line. Note that comments should only be hoisted for 
loops and
----------------
hubert.reinterpretcast wrote:
> I'm happy with the implications of how this is phrased, but I am not sure it 
> was intended. A statement that is not going to be a single line (a loop 
> inside an else) qualifies for braces.
> A statement that is not going to be a single line (a loop inside an else) 
> qualifies for braces.

I would agree to that. 


================
Comment at: llvm/docs/CodingStandards.rst:1592
+    handleVarDecl(D);
+  else {
+    // In this else case, it is necessary that we explain the situation with 
this
----------------
hubert.reinterpretcast wrote:
> I believe this is an example of bad style. Applying the prose text to the 
> example:
> Adding braces in this example to the above bodies do not introduce 
> "meaningless lines of code" as the lines already occur regardless. Adding 
> braces may arguably improve readability.
> 
> Say, for the following, the lack of uniformity in the use of braces is a 
> distraction:
> ```
> if (A)
>   zip();
> else if (B) {
>   foo();
>   bar();
> } else
>   hello;
> ```
I also think a "compound statement" that has braces at some point can/should 
have them everywhere.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80947/new/

https://reviews.llvm.org/D80947



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to