After a short search on the Internet, I came to the conclusion that the designated initializers are not part of any C ++ standard, but when compiling this code using g ++ (4.7.0)
#include <iostream> using namespace std; int main(int argc, char** argv) { int test[2][2] ={ [0]={1,2}, [1]={3,4}, }; for (int x = 0; x<2;x++) { for (int y = 0; y<2; y++) { cout << test[x][y] << endl; } } return 0; }
it will compile and work fine.
Am I missing something? From all that I read, C ++ should not support this type of code.
c ++
PJMicolet
source share