Re: [Vala] Optional output parameters?



Sam Liddicott <sam    > writes:


The expression of an out parameter must be an LHS (left hand side) assigment.

You can try

*(condition?&inh:(inh_type*)NULL)

You'll have to fill inh_type with thr right type

Tried:
*(true?&inh:(int *)null)

Gives me an error:
error: Cannot pass value to reference or output parameter

With out modifier before:
error: ref and out method arguments can only be used with fields, parameters, 
and local variables

Without *:
error: Argument 7: Cannot convert from `int*' to `int'

And the same errors when I replace the expression by pointer variable.

I also tried nullable variable, which compiled, but does not do what I want, 
because the generated C code creates a new temporary and passes in the pointer 
to that, independent on the old value of the nullable variable.




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