Can I initialize Win32 structures array style?

I know a lot of people do this
1
2
3
4
5
6
7
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
and so on ...


But I would like to do this since it takes less typing
1
2
3
4
5
WNDCLASSEX wc = {
sizeof(WNDCLASSEX), 0, WndProc, 0, 0, hInstance,
LoadIcon(NULL, IDI_APPLICATION), LoadCursor(NULL, IDC_ARROW), 
(HBRUSH)GetStockObject(WHITE_BRUSH), 0, TEXT("MainCLass"), 0
};


Can I do this? Is it ok?

Last edited on
You can do this, but the first is more readable, so it's preferable in my opinion.
Topic archived. No new replies allowed.