Re: [Vala] static member variable intialization
- From: Frederik <scumm_fredo gmx net>
- To: vala-list <vala-list gnome org>
- Subject: Re: [Vala] static member variable intialization
- Date: Fri, 30 Jul 2010 22:41:50 +0200
Luca Bruno wrote:
Hi, it's not possible (at least for now) due to C limitations: see
https://bugzilla.gnome.org/show_bug.cgi?id=543189
However, a dummy instantiation before first static access should work:
class Statico : Object {
public static int test_value;
static construct {
test_value = 5;
}
public static int get_test_value () {
return test_value;
}
}
void main () {
new Statico ();
stdout.printf ("%d\n", Statico.get_test_value ());
}
Best regards,
Frederik
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]