[Vala] Array resize
- From: Giulio Paci <giuliopaci interfree it>
- To: vala-list gnome org
- Subject: [Vala] Array resize
- Date: Tue, 27 Sep 2011 22:29:14 +0200
Hi to all,
I need to put in struct a resizable array of structs. Is this possible
in Vala? I tried the following code, but it is not working as expected.
Is this code legal?
struct t{
int d;
}
struct t2{
t[] no;
}
int main(string[] args)
{
t2 fail = t2() {no = new t[1]};
t[] ok = new t[1];
for(int i=0; i<100; i++)
{
stderr.printf("%d %d\n", fail.no.length, ok.length);
fail.no.resize(fail.no.length+1);
ok.resize(ok.length+1);
}
return 0;
}
Bests,
Giulio.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]