Re: [Vala] Dynamic arrays in Vala - example for newbie



Use string[] instead of GLib.Array
The rule of thumb is to avoid GLib.Array, if possible.

vala array implements a resize method.


On Mon, Mar 30, 2009 at 2:46 PM, Leonti Bielski <prishelec gmail com> wrote:
Hello!
I'm writing an application and I've come to the point where I need to
use dynamic arrays.
I tried Garray:

GLib.Array<string> test_calls; // it's declared from the start to be global

test_calls = new GLib.Array<string>(false,  false, (uint)sizeof(string));
test_calls.append_val("some string");
debug("%s", test_calls.index(0));

It gives me segmentation fault.
How do I do this properly?

I've been searching the whole day for example in Vala and couldn't find one :(
Thanks. Leonti
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list




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