美文网首页
[c语言].bss

[c语言].bss

作者: RGW | 来源:发表于2017-08-31 23:09 被阅读14次

https://en.wikipedia.org/wiki/.bss#BSS_in_C

In C, statically-allocated objects without an explicit initializer are initialized to zero (for arithmetic types) or a null pointer (for pointer types). Implementations of C typically represent zero values and null pointer values using a bit pattern consisting solely of zero-valued bits (though this is not required by the C standard). Hence, the BSS segment typically includes all uninitialized objects (both variables and constants) declared at file scope (i.e., outside any function) as well as uninitialized static local variables (local variables declared with the static
keyword); static local constants must be initialized at declaration, however, as they do not have a separate declaration, and thus are typically not in the BSS section, though they may be implicitly or explicitly initialized to zero. An implementation may also assign statically-allocated variables and constants initialized with a value consisting solely of zero-valued bits to the BSS section.
Peter van der Linden, a C programmer and author, says, "Some people like to remember it as 'Better Save Space.' Since the BSS segment only holds variables that don't have any value yet, it doesn't actually need to store the image of these variables. The size that BSS will require at runtime is recorded in the object file, but BSS (unlike the data segment) doesn't take up any actual space in the object file."[4]

[4] Peter van der Linden, Expert C Programming: Deep C Secrets, Prentice Hall 1994, p. 141

APUE

相关文章

  • [c语言].bss

    https://en.wikipedia.org/wiki/.bss#BSS_in_C In C, statica...

  • C语言内存管理

    对于一个C语言程序而言,内存空间主要由五个部分组成代码段(.text)、数据段(.data)、BSS段(.bss)...

  • Linux问题

    1.rbos内存分布,以及各个段的含义,text,data,bss等;C语言中的各类型数据存放位置,静态,全局,字...

  • uboot-step 10 C语言环境初始化

    uboot-step 10 C语言环境初始化 主要有两个工作需要完成: 1.设置堆栈 2.清BSS段 3.跳转到C...

  • 11/15

    c语言在内存中工作时分为堆栈,bss,data,code等区。功能和释放都有不同的定义。堆是人来开辟的存储空间,由...

  • iOS:栈、堆、字符串常量区、全局区

    C语言的数据在运行之前,编译器会提前预留一些内存(text 代码区,BSS、data等),这些数据不是说编译器就能...

  • bss

    gitlab代码[http://172.20.48.68/yunjing-group/console-web/wo...

  • 帮 C/C++ 程序员彻底了解链接器

    http://blog.jobbole.com/96225/#compiler_chs .bss: BSS全称为B...

  • 关于内存五大分区

    关于内存五大分区 BSS段: BSS段( bss segment )通常是指用来存放程序中未初始化的全局变量和静态...

  • 理解bss段为啥不占磁盘空间

    elf文件中的.bss段,存放未初始化的全局变量,将.data和.bss分开的理由是为了节约磁盘空间,.bss不占...

网友评论

      本文标题:[c语言].bss

      本文链接:https://www.haomeiwen.com/subject/bohrpttx.html