Re: [Vala] struct assignment



On Wed, 2007-08-29 at 01:46 +0100, Alberto Ruiz wrote:
In C it's pretty common to do struct assignment like this:

typedef struct _Foo {
int a;
int b;
int c;
} Foo;

Foo thing = {1, 2, 3};

The problem is, once wrapped, you need to do the assignment field by
field: 
var thing = new Foo();
thing.a = 1;
thing.b = 2;
thing.c = 3;

As discussed on IRC, we'll probably implement

Foo thing = new Foo () { a = 1, b = 2, c = 3 };

That's the same syntax as C# 3.0 uses for object initializers.

Regards,

Jèrg




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]