I came across this code on reddit . I would have thought that type conversions would make this invalid.
int a[3] = { { {1, 2}, {3, 4}, 5, 6 }, {7, 8}, {9}, 10 };
In clang, I get a few warnings about excessive elements and curly braces in a scalar initializer. But the content of a is [1, 7, 9] .
This is really legal, and if so, can someone explain what exactly is happening?
c
Bill Lynch Mar 20 '12 at 17:44 2012-03-20 17:44
source share