aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/CodingGuidelines
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/CodingGuidelines')
-rw-r--r--Documentation/CodingGuidelines25
1 files changed, 25 insertions, 0 deletions
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index c1046abfb7..f474120425 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -298,6 +298,17 @@ For C programs:
. since late 2021 with 44ba10d6, we have had variables declared in
the for loop "for (int i = 0; i < 10; i++)".
+ . since late 2023 with 8277dbe987 we have been using the bool type
+ from <stdbool.h>.
+
+ C99 features we have test balloons for:
+
+ . since late 2024 with v2.48.0-rc0~20, we have test balloons for
+ compound literal syntax, e.g., (struct foo){ .member = value };
+ our hope is that no platforms we care about have trouble using
+ them, and officially adopt its wider use in mid 2026. Do not add
+ more use of the syntax until that happens.
+
New C99 features that we cannot use yet:
. %z and %zu as a printf() argument for a size_t (the %z being for
@@ -315,6 +326,9 @@ For C programs:
encouraged to have a blank line between the end of the declarations
and the first statement in the block.
+ - Do not explicitly initialize global variables to 0 or NULL;
+ instead, let BSS take care of the zero initialization.
+
- NULL pointers shall be written as NULL, not as 0.
- When declaring pointers, the star sides with the variable
@@ -877,6 +891,17 @@ Characters are also surrounded by underscores:
As a side effect, backquoted placeholders are correctly typeset, but
this style is not recommended.
+ When documenting multiple related `git config` variables, place them on
+ a separate line instead of separating them by commas. For example, do
+ not write this:
+ `core.var1`, `core.var2`::
+ Description common to `core.var1` and `core.var2`.
+
+Instead write this:
+ `core.var1`::
+ `core.var2`::
+ Description common to `core.var1` and `core.var2`.
+
Synopsis Syntax
The synopsis (a paragraph with [synopsis] attribute) is automatically