Re: [Vala] How to define a const string array in Vala?
- From: JM <interflug1 gmx net>
- To: PCMan <pcman tw gmail com>
- Cc: vala-list <vala-list gnome org>
- Subject: Re: [Vala] How to define a const string array in Vala?
- Date: Wed, 21 Dec 2011 11:38:38 +0100
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[] = {
"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 the same result.
Every element of the string array gets copied.
So, If I need an array containing constant unowned strings, how to define
it in Vala?
Besides, in C language, we can write "const char* const *".
In Vala, I cannot find equivalent stuff.
Help is needed.
Thanks a lot!
_______________________________________________
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]