Re: [Vala] Vala : Suggestion for improvement : String Class wrapper for strings in Vala
- From: Gavrilov Maksim <ulltor gmail com>
- To: vala-list gnome org
- Subject: Re: [Vala] Vala : Suggestion for improvement : String Class wrapper for strings in Vala
- Date: Tue, 21 Jun 2011 21:56:39 +0400
21.06.2011 11:05, Serge Hulne пишет:
You will notice that in the second case (the naive straightforward
formulation) the data is duplicated (passed by value in the
assignment) whereas in the first case (which uses a class wrapper) the
object a is assigned to b by reference (not by value, i.e. the data is
not duplicated)
'string' is a kind of primitive in Vala, it's designed to be passed by
value. Just like int, double, etc. in C. If you want not to duplicate a
string, use 'unowned' keyword, like:
string a = "hello";
unowned string b = a;
--
Best regards, Gavrilov Maksim.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]