On 8/30/06, Nikolai Weibull <[EMAIL PROTECTED]> wrote:
On 8/29/06, Brad Beveridge <[EMAIL PROTECTED]> wrote:
> On 29/08/06, Ilya <[EMAIL PROTECTED]> wrote:
> > Brad Beveridge wrote:
> > >    static char string[2] = {0};
> > Should not you have "= {0, 0}" here?  Second element never get
> > initialized but it could be accessed by ml_append_string.
>
> That might be more clear perhaps, but when you initialize an array
> like that in C, the last element is propagated for the whole array.

What C compiler are you using?  The last element is /not/ propagated
in C.  The rest of the array will be initialized to zero, which is the

In C89 this is true.  In C99, you can initialize values out of order
and by index range, and the final value in an array initializer is
propogated to the rest of the values.

http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gcc/designated-inits.html

default for variables declared as being static.  Actually, the
explicit initialization to zero is redundant and actually causes the
size of the resulting executable to increase.  See
http://people.redhat.com/drepper/dsohowto.pdf for a better explanation
than I could give here.

  nikolai


Chris

Reply via email to