This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: what's this syntax ?


Hi Michael,

I think the '...' is called an ellipsis in the array initializer.

So you can do something like:

int array[10] = { [4] = 9, [1 ... 2] = 88, [7 ... 9] = 1 };

It's valid C99 code.

IIRC, it's *NOT* valid C90 or C++98 code.  (I'm not sure if GCC provides
convenience extensions that you may have to disable in a C90 or C++98
environment.)

You may find this output of interest:

gcc -S test.c
cat test.s

HTH,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]