Re: [Vala] Optional output parameters?



I guess there is no way out. You'll have to copy and paste the code four times.

Yu

On Fri, Apr 10, 2009 at 12:39 PM, Jan Hudec <bulb ucw cz> wrote:
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.

_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list



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