I've been seeing this sort of thing only fairly recently it seems ...
WNDCLASSEX wc={};
How long has this been legal? Is it some recent extension to the C++ standards? This seems to compile fine as a C++ program using a fairly recent C++ compiler ...
#include <cstdio>
#define BYTES 16
struct Etwas
{
int a;
int b;
double c;
};
int main()
{
Etwas obj={};
char szBytes[BYTES]={};
printf("obj.a=%d\n",obj.a);
printf("obj.b=%d\n",obj.b);
printf("obj.c=%f\n\n",obj.c);
for(int i=0; i<BYTES; i++)
printf("%d\t%c\n",i,szBytes[i]);
getchar();
return 0;
}
However, using VC6 (circa 1998 or so) and compiling as a C program, with the struct keyword in front of the Etwas struct, it won't compile. VC6 errors out on the {} brackets lines 12 and 13.
What I'm wondering is if I just failed to learn this or if its something recent? I've just never seen that idiom until recently. Can anyone tell me anything about it?
The first C++ standard was ratified in 1998, so it very well could be that VC6 was not following the standard yet. In C (which would be support pre-standard) you had to have at least one statement inside the brackets.