Acked-by: Vladimir Medvedkin <vladimir.medved...@intel.com>
On 27/03/2025 16:28, Bruce Richardson wrote:
Remove obsolete, and generally not followed, advice in the coding
standards doc, around local variables.
Signed-off-by: Bruce Richardson <bruce.richard...@intel.com>
---
doc/guides/contributing/coding_style.rst | 4 ----
1 file changed, 4 deletions(-)
diff --git a/doc/guides/contributing/coding_style.rst
b/doc/guides/contributing/coding_style.rst
index 1ebc79ca3c..0d8821b325 100644
--- a/doc/guides/contributing/coding_style.rst
+++ b/doc/guides/contributing/coding_style.rst
@@ -556,14 +556,10 @@ Exits should be 0 on success, or 1 on failure.
Local Variables
~~~~~~~~~~~~~~~
-* Variables should be declared at the start of a block of code rather than in the middle.
- The exception to this is when the variable is ``const`` in which case the
declaration must be at the point of first use/assignment.
- Declaring variable inside a for loop is OK.
* When declaring variables in functions, multiple variables per line are OK.
However, if multiple declarations would cause the line to exceed a
reasonable line length, begin a new set of declarations on the next line rather
than using a line continuation.
* Be careful to not obfuscate the code by initializing variables in the
declarations, only the last variable on a line should be initialized.
If multiple variables are to be initialized when defined, put one per line.
-* Do not use function calls in initializers, except for ``const`` variables.
.. code-block:: c
--
Regards,
Vladimir