Re: [Vala] Optional output parameters?



Although my suggestion was clearly obscene from a coding point of view I think it ought to have worked.

It ought to be possible to pass an dereferenced  pointer as an out.

Maybe vala rejected it because it was an expression. Try putting the expression in the line before and 
storing the result in an int* tmp and then passing *tmp. If that doesn't work then it is a vala bug IMHO.

Sam


-----Original Message-----
From: Jan Hudec <bulb ucw cz>
Sent: Friday, April 10, 2009 5:39 PM
To: vala-list gnome org
Subject: 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.

_______________________________________________
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]