ERROR: do not initialise statics to false

Question about git commit rule

I git commit a patch,
The patch has a "static int xxxxxxxxxxxxxxxxxxxxxxxxxx = 0;"
It show error messge "ERROR: do not initialise statics to false"
Why can't initialize a static variable = false in function ?

All static variable that is uninitialize are moved to BSS section.
Linux initialize these static variable to zero in BSS section.
So just write "static variable" in function.

Example :
incorrect.c

#include <stdio.h>
int main()
{
        static int xxxxxxxxxxxxxxxxxxxxxxxxxx = 0;
        static int aaaaaaaaaaaaaaaaaaaaaaaaaa = 0;

        printf("exit 
");
}

correct.c

#include <stdio.h>
int main()
{
        static int xxxxxxxxxxxxxxxxxxxxxxxxxx;
        static int aaaaaaaaaaaaaaaaaaaaaaaaaa;

        printf("exit 
");
}
gcc -o correct correct.c
objdump -x correct | grep bss
 24 .bss          00000010  0000000000601040  0000000000601040  00001040  2**2
0000000000601040 l    d  .bss   0000000000000000              .bss
0000000000601040 l     O .bss   0000000000000001              completed.7262
0000000000601044 l     O .bss   0000000000000004              aaaaaaaaaaaaaaaaaaaaaaaaaa.2200
0000000000601048 l     O .bss   0000000000000004              xxxxxxxxxxxxxxxxxxxxxxxxxx.2199
0000000000601050 g       .bss   0000000000000000              _end
0000000000601040 g       .bss   0000000000000000              __bss_start

Reference:
http://www.jollen.org/blog/2007/01/no-zero-initialized-in-bss.htmlbvg

原文地址:https://www.cnblogs.com/youchihwang/p/9535303.html