doc/contributing: remove obsolete advice in coding std

Message ID 20250327162839.2472573-1-bruce.richardson@intel.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series doc/contributing: remove obsolete advice in coding std |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed

Commit Message

Bruce Richardson March 27, 2025, 4:28 p.m. UTC
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(-)
  

Comments

Medvedkin, Vladimir June 9, 2025, 10:12 a.m. UTC | #1
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
>
  

Patch

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