[asterisk-dev] Re: [asterisk-commits] kpfleming: trunk r49008
- in /trunk: ./ main/
Steve Edwards
asterisk.org at sedwards.com
Thu Dec 28 00:47:52 MST 2006
On Wed, 27 Dec 2006, Kevin P. Fleming wrote:
> Luigi Rizzo wrote:
>> boy, you really liked that! :)
>
> Yes, and it reduced the size of main/asterisk on my dev workstation by
> over 300 bytes! Yipppeeee!
I must have missed something here.
#include <stdio.h>
static int a1;
static int a2;
...
static int a1023;
static int a1024;
int main
(
int argc
, char **argv
)
{
a1 = 0;
a2 = 0;
...
a1023 = 0;
a1024 = 0;
return(0);
}
produces the exact same size executable (using gcc 3.4.6) as:
#include <stdio.h>
static int a1 = 0;
static int a2 = 0;
...
static int a1023 = 0;
static int a1024 = 0;
int main
(
int argc
, char **argv
)
{
a1 = 0;
a2 = 0;
...
a1023 = 0;
a1024 = 0;
return(0);
}
Further, I would think explicit initialization would be preferred because
it is then obvious to the next programmer (who may not know all of the
dark corners of the C standard) that you didn't "forget" to initialize or
you don't care about the variable's initial value, you really did want the
variable initialized with the "default" initialization value.
Thanks in advance,
------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-dev
mailing list