From: Junio C Hamano Date: Wed, 16 Nov 2011 07:49:07 GMT Subject: Re: [PATCH 3/4] ll-merge: initialize default_opts const Message-ID: <7vd3csqzgs.fsf@alter.siamese.dyndns.org> In-Reply-To: Ramkumar Ramachandra writes: > Hi Junio, > > Junio C Hamano wrote: >> Ramkumar Ramachandra writes: >>> [...] >>> -     static const struct ll_merge_options default_opts; >>> +     static const struct ll_merge_options default_opts = {0, 0, 0, 0}; >> >> Doesn't "static" tell us that it will be in BSS, initialized to all zero >> by definition? > > I'm uncertain about whether the C89 standard says this explicitly- icc > is more pedantic than most mainstream compilers. Actually I take a part of the comment back; as this is "static const", it is entirely plausible for a compiler to tell the linker to put it in rodata instead of bss, to cause any attempt to modify it to segv. A datum that is implicitly initialized to all zero and not allowed to be modified might appear suspect to some compiler writers (especially when they are under influence ;-)), so I am not so surprised if a compiler issued a warning saying "did you forget to initialize it?".