What's left for 1.0?

Anders F Björklund afb at algonet.se
Sat Nov 18 03:05:42 PST 2006


Walter Bright wrote:

>> C has no problem with that either:
>>
>>     struct Point { float x, y; };
>>     void foo() {
>>        Point p = {1.0,2.0};
>>     }
> 
> 
> True. I forgot it could (replacing "Point" with "struct Point").

That is not C, that is C++, and gives a compiler error:
"error: `Point' undeclared (first use in this function)"

In C you need the usual typedef-on-the-go workaround:
typedef struct Point { float x, y; } Point;

--anders



More information about the Digitalmars-d mailing list