threads / patch / 63627

patchCodingGuidelines: let BSS do its job

Subject: [PATCH] CodingGuidelines: let BSS do its job

## tl;dr

2 messages between Jun 11, 2025 and Jun 12, 2025. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Junio C Hamano· Jun 11, 2025, 21:16 UTC · lore

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

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/CodingGuidelines | 3 +++
 1 file changed, 3 insertions(+)
Show changes to Documentation/CodingGuidelines +3 −0
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index a0e7041c54..4d1d52aa37 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -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
-- 
2.50.0-rc2-207-gc448ca4963
Christian Couder· Jun 12, 2025, 07:40 UTC · re: Junio C Hamano · lore

Re: [PATCH] CodingGuidelines: let BSS do its job

On Wed, Jun 11, 2025 at 11:18 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> 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!
Show 15 quoted lines
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  Documentation/CodingGuidelines | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> index a0e7041c54..4d1d52aa37 100644
> --- a/Documentation/CodingGuidelines
> +++ b/Documentation/CodingGuidelines
> @@ -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.

← back to recent threads