lkml.org 
[lkml]   [2002]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Combined APM patch
On Fri, Jan 11, 2002 at 10:22:24AM -0500, Thomas Hood wrote:
> This is useful information,
> because if someone later wants to modify the code to make
> this variable non-static, the comment tells that person that
> the variable will need an initializer.

Whether a variable is static or not doesn't change whether it ends up in
the bss segment or not.

/* top level */
static int foo;
int bar;

Both foo and bar will be initialised to 0 - since they're both placed
into the BSS segment (or maybe its common subsection):

$ gcc -S -o - t.c
@ Generated by gcc 2.96 20000731 (Red Hat Linux 7.1 2.96-80) for ARM/elf
.file "t.c"
gcc2_compiled.:
.bss
.align 2
foo:
.space 4
.comm bar, 4 @ 4

$ gcc -S -o - t.c -fno-common
@ Generated by gcc 2.96 20000731 (Red Hat Linux 7.1 2.96-80) for ARM/elf
.file "t.c"
gcc2_compiled.:
.bss
.align 2
foo:
.space 4
.global bar
.align 2
.type bar,object
.size bar,4
bar:
.space 4


--
Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:15    [W:0.041 / U:1.736 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site