[Vala] Storing strings inside structs fails.
- From: Julian Andres Klode <jak jak-linux org>
- To: vala-list gnome org
- Subject: [Vala] Storing strings inside structs fails.
- Date: Sun, 20 Sep 2009 13:57:06 +0200
Hi,
storing a string inside a struct does not work.
If you compile the following Vala code:
struct Item {
public string uri;
}
public static void main() {
var uri = "http://google.de";
Item item = {uri};
stdout.printf("item.uri: %s\n", item.uri);
stdout.printf(" uri: %s\n", uri);
}
You will get C code like this (excerpt):
void _main (void) {
char* uri;
Item item = {g_strdup (uri)};
uri = g_strdup ("http://google.de");
which means the item is created with the 'uri' member being set
to the result of calling g_strdup() on the uninitialized 'uri'
variable. The problem exists in Vala 0.7.6 and 0.7.5, I have not
tested older versions.
--
Julian Andres Klode - Debian Developer, Ubuntu Member
See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]