From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 03/11] doc: improve coding style guide readability
Date: Wed, 14 Jan 2026 14:54:07 -0800 [thread overview]
Message-ID: <20260114225555.127448-4-stephen@networkplumber.org> (raw)
In-Reply-To: <20260114225555.127448-1-stephen@networkplumber.org>
Improve the coding style documentation
- Converting passive voice to active voice
- Using imperative mood for instructions
- Simplifying redundant phrasing
- Clarifying guidance on bool usage in structures
No technical content changes.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
doc/guides/contributing/coding_style.rst | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/doc/guides/contributing/coding_style.rst b/doc/guides/contributing/coding_style.rst
index 243a3c2959..898c84ceec 100644
--- a/doc/guides/contributing/coding_style.rst
+++ b/doc/guides/contributing/coding_style.rst
@@ -9,8 +9,8 @@ DPDK Coding Style
Description
-----------
-This document specifies the preferred style for source files in the DPDK source tree.
-It is based on the Linux Kernel coding guidelines and the FreeBSD 7.2 Kernel Developer's Manual (see man style(9)), but was heavily modified for the needs of the DPDK.
+This document specifies the preferred style for source files in the DPDK source tree,
+based on the Linux Kernel coding guidelines and the FreeBSD 7.2 Kernel Developer's Manual (see man style(9)), but was heavily modified for the needs of the DPDK.
General Guidelines
------------------
@@ -95,7 +95,7 @@ Example:
Header File Guards
~~~~~~~~~~~~~~~~~~
-Headers should be protected against multiple inclusion with the usual:
+Protect headers against multiple inclusion with the usual:
.. code-block:: c
@@ -293,7 +293,7 @@ Structure Declarations
* In general, when declaring variables in new structures, declare them sorted by use, then by size (largest to smallest), and then in alphabetical order.
Sorting by use means that commonly used variables are used together and that the structure layout makes logical sense.
Ordering by size then ensures that as little padding is added to the structure as possible.
-* For existing structures, additions to structures should be added to the end so for backward compatibility reasons.
+* For existing structures, add new members to the end for backward compatibility.
* Each structure element gets its own line.
* Try to make the structure readable by aligning the member names using spaces as shown below.
* Names following extremely long types, which therefore cannot be easily aligned with the rest, should be separated by a single space.
@@ -308,14 +308,14 @@ Structure Declarations
};
-* Major structures should be declared at the top of the file in which they are used, or in separate header files if they are used in multiple source files.
+* Declare major structures at the top of the file where they are used, or in separate header files if they are used in multiple source files.
* Use of the structures should be by separate variable declarations and those declarations must be extern if they are declared in a header file.
* Externally visible structure definitions should have the structure name prefixed by ``rte_`` to avoid namespace collisions.
.. note::
- Uses of ``bool`` in structures are not preferred as is wastes space and
- it's also not clear as to what type size the bool is. A preferred use of
+ Avoid using ``bool`` in structures because it wastes space and
+ the type size is unclear. A preferred use of
``bool`` is mainly as a return type from functions that return true/false,
and maybe local variable functions.
@@ -584,7 +584,7 @@ C Function Definition, Declaration and Use
Prototypes
~~~~~~~~~~
-* It is recommended (and generally required by the compiler) that all non-static functions are prototyped somewhere.
+* Prototype all non-static functions (the compiler generally requires this).
* Functions local to one source module should be declared static, and should not be prototyped unless absolutely necessary.
* Functions used from other parts of code (external API) must be prototyped in the relevant include file.
* Function prototypes should be listed in a logical order, preferably alphabetical unless there is a compelling reason to use a different ordering.
@@ -747,7 +747,7 @@ Static Variables and Functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* All functions and variables that are local to a file must be declared as ``static`` because it can often help the compiler to do some optimizations (such as, inlining the code).
-* Functions that should be inlined should to be declared as ``static inline`` and can be defined in a .c or a .h file.
+* Declare functions that should be inlined as ``static inline`` and can be defined in a .c or a .h file.
.. note::
Static functions defined in a header file must be declared as ``static inline`` in order to prevent compiler warnings about the function being unused.
@@ -755,7 +755,7 @@ Static Variables and Functions
Const Attribute
~~~~~~~~~~~~~~~
-The ``const`` attribute should be used as often as possible when a variable is read-only.
+Use the ``const`` attribute as often as possible when a variable is read-only.
Inline ASM in C code
~~~~~~~~~~~~~~~~~~~~
--
2.51.0
next prev parent reply other threads:[~2026-01-14 22:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-14 22:54 [PATCH 00/11] doc: improve contributing documentation clarity and style Stephen Hemminger
2026-01-14 22:54 ` [PATCH 01/11] doc: correct grammar and typos in design guide Stephen Hemminger
2026-01-14 22:54 ` [PATCH 02/11] doc: improve ABI policy documentation style Stephen Hemminger
2026-01-14 22:54 ` Stephen Hemminger [this message]
2026-01-14 22:54 ` [PATCH 04/11] doc: improve documentation guidelines style Stephen Hemminger
2026-01-14 22:54 ` [PATCH 05/11] doc: improve Linux uAPI header documentation Stephen Hemminger
2026-01-14 22:54 ` [PATCH 06/11] doc: improve new driver guide readability Stephen Hemminger
2026-01-14 22:54 ` [PATCH 07/11] doc: improve new library guide style Stephen Hemminger
2026-01-14 22:54 ` [PATCH 08/11] doc: improve patch submission guide readability Stephen Hemminger
2026-01-14 22:54 ` [PATCH 09/11] doc: improve stable releases documentation Stephen Hemminger
2026-01-14 22:54 ` [PATCH 10/11] doc: improve unit test guide readability Stephen Hemminger
2026-01-14 22:54 ` [PATCH 11/11] doc: improve vulnerability process documentation Stephen Hemminger
2026-01-16 20:14 ` [PATCH v2 00/12] doc: improve contributing documentation clarity and style Stephen Hemminger
2026-01-16 20:14 ` [PATCH v2 01/12] doc: correct grammar and typos in design guide Stephen Hemminger
2026-03-31 22:41 ` Stephen Hemminger
2026-01-16 20:14 ` [PATCH v2 02/12] doc: improve ABI policy documentation style Stephen Hemminger
2026-01-16 20:14 ` [PATCH v2 03/12] doc: improve coding style guide readability Stephen Hemminger
2026-01-16 20:14 ` [PATCH v2 04/12] doc: improve documentation guidelines style Stephen Hemminger
2026-01-16 20:14 ` [PATCH v2 05/12] doc: improve Linux uAPI header documentation Stephen Hemminger
2026-01-16 20:14 ` [PATCH v2 06/12] doc: improve new driver guide readability Stephen Hemminger
2026-01-16 20:14 ` [PATCH v2 07/12] doc: improve new library guide style Stephen Hemminger
2026-01-16 20:14 ` [PATCH v2 08/12] doc: improve patch submission guide readability Stephen Hemminger
2026-01-16 20:14 ` [PATCH v2 09/12] doc: improve stable releases documentation Stephen Hemminger
2026-01-16 20:14 ` [PATCH v2 10/12] doc: improve vulnerability process documentation Stephen Hemminger
2026-01-16 20:14 ` [PATCH v2 11/12] doc: improve unit test guide readability Stephen Hemminger
2026-01-16 20:14 ` [PATCH v2 12/12] doc: fix grammar and style in ABI versioning guide Stephen Hemminger
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=20260114225555.127448-4-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--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