[libvirt PATCH v2 2/2] docs: coding-style: One variable declaration per line

Tim Wiederhake posted 2 patches 4 years ago
There is a newer version of this series
[libvirt PATCH v2 2/2] docs: coding-style: One variable declaration per line
Posted by Tim Wiederhake 4 years ago
This was not mentioned before.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 docs/coding-style.rst | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/docs/coding-style.rst b/docs/coding-style.rst
index ee4d551805..01f1e25127 100644
--- a/docs/coding-style.rst
+++ b/docs/coding-style.rst
@@ -600,6 +600,19 @@ calling another function.
         ...
     }
 
+Prefer variable definitions on separate lines. This allows for smaller,
+easier to understand diffs when changing them. Define variables in the
+smallest possible scope.
+
+::
+
+  GOOD:
+    int count = 0;
+    int nnodes;
+
+  BAD:
+    int count = 0, nnodes;
+
 Attribute annotations
 ---------------------
 
-- 
2.31.1