On 8/30/06, Chris Littell <[EMAIL PROTECTED]> wrote:
On 8/30/06, Nikolai Weibull <[EMAIL PROTECTED]> wrote:
> In C99 you can initialize values "out of order", yes, but you can't do
> it with ranges.  Ranges are a GNU C extension.  The propagation
> neither happens in any of the ANSI standards, nor in the GNU extended
> version of C.  It's simple to test write the following in "a.c":
>
> #include <stdio.h>
>
> int
> main(void)
> {
>         int is[2] = { 1 };
>         int i;
>
>         for (i = 0; i < 2; i++)
>                 printf("%d\n", is[i]);
>
>         return 0;
> }
>
> And then to actually test it:
>
> $ for std in c89 c99 gnu89 gnu99; do gcc -std=$std a.c && echo $std:
> && a.out; done
> c89:
> 1
> 0
> c99:
> 1
> 0
> gnu89:
> 1
> 0
> gnu99:
> 1
> 0
>
> > 
http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gcc/designated-inits.html
>
> Nowhere in that section does it say that the last value is propagated.

Wow, I reread it and you are correct.  I'm not sure why I held that
assumption...
Also thanks for the examples.

No worries.

 nikolai

Reply via email to