.NET Framework - C99 array initializer in VS2008

Asked By Mike on 15-Feb-09 02:24 AM
Hi, I've got Visual Studio 2008, and I'm writing code that follows the
C99 array initializer standard as follows:

char * foo[] = {
[2] = "a",
[5] = "b",
[7] = "c"

When I try to compile this, I get:

arraytest.c(2) : error C2059: syntax error : '['

(line 2 is '  [2] = "a",')

I tried searching MSDN, but either I don't know what to search for, or
nobody's really run into this.  Is there a flag or properties setting
I can turn on to get the above code to compile properly?

I wrote a python script to generate new code that initializes the
sparse array the old way, but that's pretty ugly, and my real array
ends up being very large.

I appreciate the help!  Thanks,

Kenneth Cochran replied on 11-Feb-09 09:37 AM
As far as I know designated initializers are not supported in VS2008.
David Wilkinson replied on 11-Feb-09 12:55 PM
As far as I know, VC does not support C99 at all, and there are no plans to do
so, except to the extent that C99 features may be the same as ones added to the
C++ standard.

David Wilkinson
Visual C++ MVP
Mike replied on 15-Feb-09 02:24 AM
Thanks guys...I was afraid this was the answer.


to do
to the