erichkeane marked 6 inline comments as done. erichkeane added inline comments.
================ Comment at: llvm/docs/CodingStandards.rst:1578 +unnecessary and otherwise meaningless code. Braces should be used however +in cases where it significantly improves readability, such as when the single +statement is accompanied by a comment that loses its meaning if hoisted above the `if` ---------------- hubert.reinterpretcast wrote: > I think "navigability" is also negatively affected by omission of braces. > This seems to be an aspect of readability this is not always considered. It > tends to be easier to consume code in an editor when placing a cursor on a > brace highlights the matching brace. If a reviewer in a web interface needed > to scroll or "draw a line" to where a loop or if/else chain starts when > reaching the end of a block, then the lack of braces is harmful. This would > especially be the case if the code was such that having comments after the > brace would be helpful. > > The use of braces to proactively avoid running into the dangling-else problem > should also be permitted or even encouraged. > > Replacing the list of cases where braces help readability with a list of > cases where omitting braces are harmful may help. We can then enforce braces > for some classes of harmful brace-omission and permit braces for other > classes. > > Examples of "mild" harmful cases can then include mixing of braced and > non-braced blocks in an if/else chain. Can you suggest an alternate wording here? I'm not sure how to capture what you're saying. 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