| freddie1 (847) | |||||
I've been seeing this sort of thing only fairly recently it seems ...
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 ...
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? | |||||
|
|
|||||
| ResidentBiscuit (2655) | ||
http://stackoverflow.com/questions/1352370/c-static-array-initialization-how-verbose-do-i-need-to-be/1352379#1352379
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. | ||
|
|
||
| freddie1 (847) | |||
geez! Some obscure stuff. That worked though. I just added the '0', and it compiled and ran OK ...
| |||
|
|
|||
| freddie1 (847) | |
|
Here's the output from that, by thev way. The 1 - 15 numbers with nothing after them are from the loop, and all the bytes are null. obj.a=0 obj.b=0 obj.c=0.000000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
|
|
|