Date: Fri, 11 May 2012 08:57:29 -0400 From: David Chisnall <theraven@FreeBSD.org> To: Konstantin Belousov <kostikbel@gmail.com> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Gabor Kovesdan <gabor@FreeBSD.org> Subject: Re: svn commit: r235267 - in head/usr.bin/sort: . nls Message-ID: <6AE99277-D90F-453D-AE40-EE731DFD3BAB@FreeBSD.org> In-Reply-To: <20120511124820.GN2358@deviant.kiev.zoral.com.ua> References: <201205111237.q4BCbGX2083596@svn.freebsd.org> <20120511124820.GN2358@deviant.kiev.zoral.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
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 >=20 >> +bool byte_sort =3D false; >> + >> +static wchar_t **wmonths =3D NULL; >> +static unsigned char **cmonths =3D NULL; >=20 > 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.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6AE99277-D90F-453D-AE40-EE731DFD3BAB>