Update C++ style guide

One small update to clarify that omitting braces on control blocks is
permitted but discouraged.
This commit is contained in:
Daniel Cheng authored and Mike Frysinger committed 2026-06-03 11:51:22 -04:00
1 parent 3c5c895c68
commit 1809c769de
1 file changed
+6 -6
+6 -6
View File
@@ -5557,12 +5557,12 @@ if (condition1 &&
DoSomething();
</pre>
<p>For historical reasons, we allow one exception to the above rules: the curly
braces for the controlled statement or the line breaks inside the curly braces
may be omitted if as a result the entire statement appears on either a single
line (in which case there is a space between the closing parenthesis and the
controlled statement) or on two lines (in which case there is a line break
after the closing parenthesis and there are no braces).</p>
<p>For historical reasons, we allow, but discourage, one exception to the above
rules: the curly braces for the controlled statement or the line breaks inside
the curly braces may be omitted if as a result the entire statement appears on
either a single line (in which case there is a space between the closing
parenthesis and the controlled statement) or on two lines (in which case there
is a line break after the closing parenthesis and there are no braces).</p>
<pre class="neutralcode">// OK - fits on one line.
if (x == kFoo) { return new Foo(); }