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      [EMAIL PROTECTED]      Voice: +1-760-468-3867 PST
Newline                                             Fax: +1-760-731-3000
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to