KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The CDT parser reports a syntax error for the structure initialization: typedef struct MyStruct { int a; float b; }; int main( void ) { // GNU C extension format MyStruct s = {a : 1, b : 2}; // C99 standard format // MyStruct s = {.a = 1, .b = 2}; return 0; } While GCC lists the : form as obsolete , it would seem that it has not been deprecated nor removed. In C99 I would certainly use the standard .<name> = form but for C++, the : is the only option that I am aware of for designated initialization. I have tried setting my toolchain to both MinGW and Cross GCC, but neither seem to work. How can I get Eclipse to recognize this syntax? It's not a big deal for one line but it carries through to every other instance of the variable since Eclipse does not realize it is declared.
Tags (comma-separated)
Save Edits
Cancel