Update braces style

Fri, 09 Jun 2017 09:18:57 +0200

author
David Demelier <markand@malikania.fr>
date
Fri, 09 Jun 2017 09:18:57 +0200
changeset 10
eaae1fcabca8
parent 9
ee0ef058cb94
child 11
e4fd9e7bf69a

Update braces style

STYLE_CPP.md file | annotate | diff | comparison | revisions
--- a/STYLE_CPP.md	Fri Feb 24 11:44:55 2017 +0100
+++ b/STYLE_CPP.md	Fri Jun 09 09:18:57 2017 +0200
@@ -17,18 +17,26 @@
 Braces follow the K&R style, they are never placed on their own lines except for
 function definitions.
 
-In addition to the K&R style, they are required everywhere even if a block
-contains only one statement.
+Do not put braces for single line statements except for clarity.
 
     if (condition) {
         apply();
         add();
-    } else {
+    } else
         ok();
+
+    if (condition)
+        validate();
+
+    if (foo) {
+        state = long + conditional + that + requires + several + lines +
+            to + complete;
     }
 
-    if (condition) {
-        validate();
+Functions require braces on their own lines.
+
+    void function()
+    {
     }
 
 And a lambda has its braces on the same lines too:

mercurial