Re: [Vala] Dynamic arrays in Vala - example for newbie
- From: Leonti Bielski <prishelec gmail com>
- To: Yu Feng <rainwoodman gmail com>
- Cc: Vala-list gnome org
- Subject: Re: [Vala] Dynamic arrays in Vala - example for newbie
- Date: Tue, 31 Mar 2009 16:56:03 +0200
You are right, it's was a bug.
Today I updated my vala to 0.6.0 and it works now.
Leonti
On Tue, Mar 31, 2009 at 7:18 AM, Yu Feng <rainwoodman gmail com> wrote:
I bet it is a bug.
Yu
On Tue, 2009-03-31 at 00:14 +0200, Leonti Bielski wrote:
Ok, thanks for the advise then.
Now I have different problem. If I do the code below inside a
function, it works:
/-----------------------------------------------
string[] a;
a= {};
a += "sometext";
/-------------------------------------------------
But if I do initialization outside the scope to make array global:
string[] a;
And then inside the function:
/-------------------------------
a= {};
a += "sometext";
--------------------------------
I get following error:
error: ‘a_size’ undeclared (first use in this function)
How do I declare global array properly?
Leonti
On Mon, Mar 30, 2009 at 11:06 PM, Feng Yu <rainwoodman gmail com> wrote:
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]