This is a followup to my thread yesterday regarding consistent enforcement of the style guide. Like Yong Li, I find the current rule about braces on conditional arms to be suboptimal. The current rule is that one-line arms must not have braces. This leads to strange constructions like:
if (foo) { a; b; c; // etc., very long body } else x; ...or perhaps: if (foo) a; else if (bar) { b; c; } else if (baz) d; else if (qux) { e; f; } I find this tricky to read and error-prone. I propose that the rule be modified to be: * When all arms of a conditional or loop are one physical line, do not use braces. If any arms are more than one physical line (even if they are one logical line), use braces on all arms. In most places this will not differ from the existing code, so it will not "cause the whole codebase to become invalid"; but it prevents cases where the inconsistency leads (IMO) to lower readability/safety. (As a bonus for Chromium developers, it's compatible with the Google style guide too, although it goes further than that guide in order to make the correct style explicit in all cases.) PK
_______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev