On 11 May 2012, at 08:48, Konstantin Belousov wrote:

> On Fri, May 11, 2012 at 12:37:16PM +0000, Gabor Kovesdan wrote:
>> Author: gabor
>> Date: Fri May 11 12:37:16 2012
>> New Revision: 235267
>> URL: http://svn.freebsd.org/changeset/base/235267
> 
>> +bool byte_sort = false;
>> +
>> +static wchar_t **wmonths = NULL;
>> +static unsigned char **cmonths = NULL;
> 
> Such initializations are useless. You only increase the size of the binary
> on the disk as the consequence.

Really?  The C specification requires all globals and statics that are not 
explicitly initialised to be set to their zero value, so this initialisation 
has no effect on the resulting binary[1].  These are placed in the BSS section, 
irrespective of whether the initialisation is implicit or explicit and the 
loader is responsible for allocating space for them - all that is stored in the 
binary is the size.

For local variables, initialisation like this has no effect even at low 
optimisation levels - dead stores will be removed.  It does, however, make it 
more difficult for the compiler to distinguish between initialised and 
initialised sensibly in some cases.

David

[1] In a standards-compliant compiler.  Apparently a few shipping compilers for 
embedded systems fail to respect this, but everything FreeBSD is compiled with 
does._______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to