Re: [Vala] How to define a const string array in Vala?

2011-12-21 Thread JM
Sorry, to avoid copying it should be like this: const string constar[] = {"first", "second", "third"}; void main () { foreach(unowned string s in constar) print("s: %ss\n", s); } Am Mittwoch, den 21.12.2011, 11:38 +0100 schrieb JM: > For example, you can do it like this: >

Re: [Vala] How to define a const string array in Vala?

2011-12-21 Thread JM
For example, you can do it like this: const string constar[] = {"first", "second", "third"}; void main () { foreach(string s in constar) print("s: %ss\n", s); } Am Mittwoch, den 21.12.2011, 16:34 +0800 schrieb PCMan: > I C language, I can do this: > const char* strs[] = {

[Vala] How to define a const string array in Vala?

2011-12-21 Thread PCMan
I C language, I can do this: const char* strs[] = { "string1", "string2", "string3", NULL }; In Vala, I cannot find a way to do the same. Defining a string[] will cause copy of every constant string. If I use unowned, like this: unowned string strs[] = { ... }; This did not generate th