di.cpp: ------ #include <iostream> using namespace std; struct foo { int a; int b; }; int main(int, char **) { const foo f = { .a = 10, .b = 11 }; cout << f.a << ' ' << f.b << endl; return 0; } ----- $ clang++ -Wall -Wextra -Weffc++ -o di di.cpp $ ./di 10 11 It is a standard C99! Or am I wrong? $ clang++ --version clang version 2.8 (branches/release_28) Target: i386-pc-linux-gnu Thread model: posix -- http://mdf-i.blogspot.com Andrey Valyaev
On Jan 13, 2011, at 1:33 PM, Andrey Valyaev wrote:> di.cpp: > ------ > #include <iostream> > using namespace std; > > struct foo { > int a; > int b; > }; > > int main(int, char **) > { > const foo f = { .a = 10, .b = 11 }; > cout << f.a << ' ' << f.b << endl; > return 0; > } > ----- > > $ clang++ -Wall -Wextra -Weffc++ -o di di.cpp > $ ./di > 10 11 > > It is a standard C99! > Or am I wrong?Hi Andrey, I don't understand what you're asking here. It might be best to post to cfe-dev to get clang-specific answer. -Chris> > $ clang++ --version > clang version 2.8 (branches/release_28) > Target: i386-pc-linux-gnu > Thread model: posix > > -- > http://mdf-i.blogspot.com > Andrey Valyaev > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Chris Lattner <clattner at apple.com> writes:> On Jan 13, 2011, at 1:33 PM, Andrey Valyaev wrote: > >> di.cpp: >> ------ >> #include <iostream> >> using namespace std; >> >> struct foo { >> int a; >> int b; >> }; >> >> int main(int, char **) >> { >> const foo f = { .a = 10, .b = 11 }; >> cout << f.a << ' ' << f.b << endl; >> return 0; >> } >> ----- >> >> $ clang++ -Wall -Wextra -Weffc++ -o di di.cpp >> $ ./di >> 10 11 >> >> It is a standard C99! >> Or am I wrong? > > Hi Andrey, > > I don't understand what you're asking here. It might be best to post > to cfe-dev to get clang-specific answer.I think he is surprised to see clang accepting C99-style struct initializers on a C++ program.