m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: several buglets in CVS m4


From: Eric Blake
Subject: Re: several buglets in CVS m4
Date: Mon, 19 Jun 2006 16:07:37 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> writes:

> OK, except for...
> 
> > -  int number[3];
> > +  int number[3] = {0};
> 
> this which won't initialize number[2].

Yes it will.  The C standard requires that all unspecified array members be 0-
initialized if at least the first array member is explicitly initialized:

$ cat foo.c
#include <stdio.h>
int main()
{
   int number[3]
#if INIT
      = {0}
#endif
   ;
   return printf("%d %d %d\n", number[0], number[1], number[2]);
}
$ gcc -Wall -O2 -o foo foo.c
$ ./foo
1628854574 47 2086312361
$ gcc -Wall -O2 -o foo foo.c -DINIT=1
$ ./foo
0 0 0


-- 
Eric Blake






reply via email to

[Prev in Thread] Current Thread [Next in Thread]