* [PATCH] doc/contributing: remove obsolete advice in coding std
@ 2025-03-27 16:28 Bruce Richardson
2025-06-09 10:12 ` Medvedkin, Vladimir
0 siblings, 1 reply; 2+ messages in thread
From: Bruce Richardson @ 2025-03-27 16:28 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson
Remove obsolete, and generally not followed, advice in the coding
standards doc, around local variables.
Signed-off-by: Bruce Richardson <bruce.richardson@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
--
2.45.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] doc/contributing: remove obsolete advice in coding std
2025-03-27 16:28 [PATCH] doc/contributing: remove obsolete advice in coding std Bruce Richardson
@ 2025-06-09 10:12 ` Medvedkin, Vladimir
0 siblings, 0 replies; 2+ messages in thread
From: Medvedkin, Vladimir @ 2025-06-09 10:12 UTC (permalink / raw)
To: Bruce Richardson, dev
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@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.richardson@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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-09 10:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-27 16:28 [PATCH] doc/contributing: remove obsolete advice in coding std Bruce Richardson
2025-06-09 10:12 ` Medvedkin, Vladimir
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).