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 \n");
}

correct.c

#include <stdio.h>
int main()
{
static int xxxxxxxxxxxxxxxxxxxxxxxxxx;
static int aaaaaaaaaaaaaaaaaaaaaaaaaa; printf("exit \n");
}
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

ERROR: do not initialise statics to false的更多相关文章

  1. error: { "$err" : "not master and slaveOk=false", "code" : 13435 }

    rsguo:SECONDARY> db.users.find();error: { "$err" : "not master and slaveOk=false&q ...

  2. 【GoLang】GoLang 官方 对 error 处理的意见

    The Go Blog Errors are values 12 January 2015 A common point of discussion among Go programmers, esp ...

  3. 解决Eclipse启动Tomcat时报Error loading WebappClassLoader错误

    最近新建了一个JSF项目(网上查到用Struts,Spring MVC也会如此),配置好以后用Eclipse启动Tomcat报了如下错误:严重: Error loading WebappClassLo ...

  4. MongoDb的“not master and slaveok=false”错误及解决方法,读写分离

    首先这是正常的,因为SECONDARY是不允许读写的, 在写多读少的应用中,使用Replica Sets来实现读写分离.通过在连接时指定或者在主库指定slaveOk,由Secondary来分担读的压力 ...

  5. MongoDB的“not master and slaveok=false”错误解决

    在客户端操作MongoDB时经常会如下错误: SECONDARY> show collections; Fri Jul :: uncaught exception: error: { } 原因是 ...

  6. iview组件 eslint校验出错 Parsing error: x-invalid-end-tag

    如下: 解决: 在.eslintrc.js文件中加上: rules: { // allow async-await 'generator-star-spacing': 'off', // allow ...

  7. js里面return 和 return false的区别

    js里面return 和 return false的区别 1.都可以终止执行当前方法: 2.如果方法A调用了方法B,则在方法A中使用return可以终止程序,但是在方法B中使用return则终止执行B ...

  8. return false 和 return true

    常规用法 在普通函数中:return 语句终止函数的执行,并返回一个指定的值给函数调用者,一般会用一个变量接收这个返回值再进行其它处理.如果未指定返回值,则返回 undefined 其中,返回一个函数 ...

  9. 《Note --- Unreal --- MemPro (CONTINUE... ...)》

    Mem pro 是一个主要集成内存泄露检测的工具,其具有自身的源码和GUI,在GUI中利用"Launch" button进行加载自己待检测的application,目前支持的平台为 ...

随机推荐

  1. 【bzoj1782】[Usaco2010 Feb]slowdown 慢慢游 树链剖分+线段树

    题目描述 每天Farmer John的N头奶牛(1 <= N <= 100000,编号1…N)从粮仓走向他的自己的牧场.牧场构成了一棵树,粮仓在1号牧场.恰好有N-1条道路直接连接着牧场, ...

  2. 洛谷 [SCOI2010]股票交易 | 单调性DP

    题目链接 #include<cstdio> #include<algorithm> #include<cstring> #define N 2005 using n ...

  3. Spring.NET中事务管理【转】

    http://www.cnblogs.com/GoodHelper/archive/2009/11/16/springnet_transaction.html 浏览了下写的比较清楚. 在.NET FC ...

  4. Eclipse的Project Facets属性设置解决项目无故报错

    新检出项目,发现代码无故报错,各种尝试,最终发现是因为  项目右键中的 project Facets 属性中的 java 后面的 version 版本和项目 build path 的 jdk 版本不一 ...

  5. 洛谷P3396 哈希冲突 (分块)

    洛谷P3396 哈希冲突 题目背景 此题约为NOIP提高组Day2T2难度. 题目描述 众所周知,模数的hash会产生冲突.例如,如果模的数p=7,那么4和11便冲突了. B君对hash冲突很感兴趣. ...

  6. Python数据处理和数据可视化

    工具1:numpy 下载地址:http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy 入门文档:https://docs.scipy.org/doc/nump ...

  7. opencv学习笔记二

    1,读取照片(imread()) 2,处理照片(cvtcolor()) 3,命名窗口(namewindow()) 4,显示照片(imshow()) 5,保存照片(imwrite()) #include ...

  8. AndroidManifest Ambiguity方案原理及代码

    1简述 前段时间在bluebox的一份android安全pdf中看到一个AndroidManifest Ambiguity方案.该方案基于android系统解析AXML的一个特点:android在解析 ...

  9. ubuntu18.04server设置静态IP

    16.04以后的版本配置静态IP是类似这样的文件 /etc/netplan/50-cloud-init.yaml 1.查询网卡名称 2.修改配置文件/etc/netplan/50-cloud-init ...

  10. Babel 和 PostCss 的一些基本配置

    Babel 是一个javascript编译器,PostCSS 是一个样式转换工具.两者都可以看作是一个转化平台,我们可以在上面使用一些插件,来达到想要的代码转化.几乎每个前端项目都要使用它们. Bab ...