From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH] doc/contributing: remove obsolete advice in coding std
Date: Thu, 27 Mar 2025 16:28:39 +0000 [thread overview]
Message-ID: <20250327162839.2472573-1-bruce.richardson@intel.com> (raw)
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
reply other threads:[~2025-03-27 16:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250327162839.2472573-1-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).