Skip to contentSkip to conversation

CodingGuidelines: let BSS do its job

PATCH In review Junio C Hamano 2 participants 2 messages Jun 11, 2025 – Jun 12, 2025 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CodingGuidelines: let BSS do its job

We have mentioned this in various reviews, but I didn't see it mentioned in the CodingGuildelines document. Let's add it.

---
 Documentation/CodingGuidelines | 3 +++
 1 file changed, 3 insertions(+)
Documentation/CodingGuidelines +3 -0
index a0e7041c54..4d1d52aa37 100644
@@ -315,6 +315,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
Signature · 1 line
2.50.0-rc2-207-gc448ca4963
#1 lore raw
Quoted 3 lines · Junio C Hamano

We have mentioned this in various reviews, but I didn't see it mentioned in the CodingGuildelines document. Let's add it.

Yeah, thanks for maintaining this document!

Quoted 10 lines
---
 Documentation/CodingGuidelines | 3 +++
 1 file changed, 3 insertions(+)
Documentation/CodingGuidelines +0 -0
index a0e7041c54..4d1d52aa37 100644

Documentation/CodingGuidelines For C programs: · line 319

Quoted 5 lines
Documentation/CodingGuidelines +2 -0
@@ -315,6 +315,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.

Looks good.