This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: = {0} in bss?
Paul Brook <paul@codesourcery.com> writes:
> On Tuesday 22 August 2006 20:14, Mike Stump wrote:
> > I hate to even bring this up, but... should things like:
> >
> > int m[1 << 27] = {0};
> >
> > be put in .bss? I'm tempted to say no, if you want that, you have to
> > remove {0}.
>
> What makes you say this?
>
> Given that C requires global variables without explicit initialisers be zero
> initialised I would find it surprising if adding explicit zero initialisation
> effected my program in any way.
One difference that it makes is that if you don't have the explicit
initializer, you could still write
int m[1 << 27];
in a different translation unit; but if you do, it will produce a
duplicate symbol error in the linker. (Assuming -fcommon, and
-fno-zero-initialized-in-bss.)