I have add bug 'Bug 771594 - check lifetime assigment to unowned and
weak reference' on https://bugzilla.gnome.org/show_bug.cgi?id=771594
I have try also to create a patch of 1 of the 2 doungerous scenarious.
regards.
2016-09-17 8:46 GMT+02:00 Nor Jaidi Tuah :
> On Sat, 2016-09-17 at 05:56 +
On Sat, 2016-09-17 at 05:56 +, michele.dioni...@gmail.com wrote:
> Parameter is unowned by default. So when you print a it point to an
> object aleady free.
You are right. Thank you for pointing out
this trap.
I agree with you that the compiler should warn
about this. I thought that 'unowned'
Parameter is unowned by default. So when you print a it point to an object
aleady free.
Il sab set 17 02:26:36 2016 GMT+0200, Nor Jaidi Tuah scrive:
>
> > string lifetime(string a) {
> > {
> > string b = "pippo";
> > a = b;
> > }
> > stdout.printf (a + "\n");
> >
> string lifetime(string a) {
> {
> string b = "pippo";
> a = b;
> }
> stdout.printf (a + "\n");
> return a;
> }
I don't think the above is an error. Otherwise, we
won't be able to do even this:
string x() {
string b = "pippo";
return b;
}
I suspect you hav