Re: [Vala] ArrayList reference count question



On 26 October 2013 16:08, Andre Masella <andre masella name> wrote:
If you look at the generated code, after the printf method, it will free the
temporary variable created when it accessed L[0].
Ah. I see.

Is there no way to assign L[0] to some kind of weak variable so there's no inc?

I tried:
weak Obj WL = L[0];
But I get "Invalid assignment from owned expression to unowned variable"

I'm thinking "Get a plain pointer to an Obj out of L[0]."
 Like the way args are passed to methods - the arg variable does not
seem to inc the ref_count.
void foo(Obj o) {printf shows the o.ref_count is 1 in here.}
Obj w = new Obj();
foo(w);

Thanks,
\d


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]