Re: [Vala] Question regarding passing a strings as arguments to a method
- From: Abderrahim Kitouni <a kitouni gmail com>
- To: Serge Hulne <serge hulne gmail com>
- Cc: vala-list <vala-list gnome org>
- Subject: Re: [Vala] Question regarding passing a strings as arguments to a method
- Date: Mon, 11 Jul 2011 08:28:24 +0100
Hello,
2011/7/11 Serge Hulne <serge hulne gmail com>:
If one has a look at the C code generated by Vala for the following
two examples, it appears that the "unowned" keyword has no influence
on the way
the string b (of type gchar*) is passed to f().
In both cases, it is passed as a pointer (without duplication).
Therefore it seems to me that the Vala tutorial is slightly misleading
and should read:
- "In Vala strings are always passed by address".
A string in Vala is a *reference* type [1] and therefore passed by
reference. The documentation is correct here, it may just need to
point out clearly that fact.
HTH,
Abderrahim
[1] it is a bit special because it is immutable, and thus copied
whenever there is a new strong reference to it
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]