I stand corrected !
Thank you Abderrahim for this detailed explanation.
Serge.
On Tue, Jun 21, 2011 at 8:56 PM, Abderrahim Kitouni wrote:
> Hello,
>
> على 21 يون, 2011 م 07:18, كتب Serge Hulne:
>
> Apparently
>>
>> string a = "hello";
>> string * b = a;
>>
>> and :
>>
>>string a = "h
Hello,
على 21 يون, 2011 م 07:18, كتب Serge Hulne:
Apparently
string a = "hello";
string * b = a;
and :
string a = "hello";
unowned string b = a;
appear to be translated by Vala into the exact same C code.
Are these two ways to declare the same thing or is this just a bug whic
It's not a bug, but just two ways to write the same thing: in Vala-style or
in C-style.
21.06.2011 22:18 пользователь "Serge Hulne" написал:
> Apparently
>
> string a = "hello";
> string * b = a;
>
> and :
>
> string a = "hello";
> unowned string b = a;
>
> appear to be translated by Vala into the
Apparently
string a = "hello";
string * b = a;
and :
string a = "hello";
unowned string b = a;
appear to be translated by Vala into the exact same C code.
Are these two ways to declare the same thing or is this just a bug which
happens to work perchance ?
Serge.
On Tue, Jun 21,
Erratum:
===
As Alexandre Rosenfeld correctly pointed out, the easy (and correct)
way to get a reference on a Vala string is simply to declare it as
follows:
string a = "hello";
string * b = a;
As illustrated in the following snippet:
///
void main (string[] argv) {
string a =
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.
Suggestion:
=
A class wrapper for the string type in Vala, in order to avoid
duplication of data in assignments (which would yield an unnecessarily
huge memory usage when processing a large amount of text with a lot of
assignments).
if you compare the C code generated by Vala for:
1)
///