From 6c68f120a55ed29576c20bea9d504e39b572b2b0 Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Thu, 13 Jan 2022 17:53:25 +0100 Subject: [PATCH] docs: coding-style: One variable declaration per line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was not mentioned before. Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa Reviewed-by: Ján Tomko Reviewed-by: Andrea Bolognani Reviewed-by: Michal Privoznik Reviewed-by: Martin Kletzander --- docs/coding-style.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/coding-style.rst b/docs/coding-style.rst index af928a16c0..cb23751721 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 ---------------------