From 1809c769de31ba388c755ad15dd057a9ba8531fd Mon Sep 17 00:00:00 2001 From: Daniel Cheng Date: Thu, 7 May 2026 15:56:11 -0700 Subject: [PATCH] Update C++ style guide One small update to clarify that omitting braces on control blocks is permitted but discouraged. --- cppguide.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cppguide.html b/cppguide.html index c5c7b98..9e849cc 100644 --- a/cppguide.html +++ b/cppguide.html @@ -5557,12 +5557,12 @@ if (condition1 && DoSomething(); -

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).

+

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).

// OK - fits on one line.
 if (x == kFoo) { return new Foo(); }