[Vala] initializing structures
- From: "Cliff Brake" <cliff brake gmail com>
- To: vala-list gnome org
- Subject: [Vala] initializing structures
- Date: Wed, 3 Sep 2008 16:14:00 -0400
Just an observation -- not sure what is supposed to work or not ....
using GLib;
public struct mystruct {
public string test1;
public int test2;
}
void main (string[] args)
{
/* the following code works fine */
mystruct my_b = {"this is a test", 10};
debug("%s, %i", my_b.test1, my_b.test2);
/* does not compile */
mystruct[] my_a = {
{"this is a test", 10};
};
/* works */
mystruct[] my_a = new mystruct[10];
/* the following code does not compile */
my_a[0] = {"this is a test", 10};
/* the following works */
my_a[0].test1 = "this is a test";
my_a[0].test2 = 10;
debug("%s, %i", my_a[0].test1, my_a[0].test2);
}
--
=======================
Cliff Brake
http://bec-systems.com
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]