Re: [Vala] Optional output parameters?



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

Sam 

-----Original Message-----
From: Jan Hudec <bulb ucw cz>
Sent: 09 April 2009 20:10
To: vala-list gnome org
Subject: [Vala] Optional output parameters?


Hello Folks,

I want to use the Glib.Process.spawn_async_with_pipes
(g_spawn_async_with_pipes) function. It has three output parameters through
which is passes back pipes it connected to the newly created process' stdin,
stdout and stderr respectively. The underlying function will not create the
pipes if the respective pointer is NULL.

Now that would be OK, if whether it will need the handler or not didn't depend
on an argument of the calling function. I want to construct a conditional 
expression (to avoid having four calls to the spawn_async_with_pipes), that 
will pass either pointer to the variable or NULL, but I am out of guesses.

I tried various things like:
condition ? out inh : null
out condition ? inh : null
out (condition ? inh : null)
???

and always got either "incompatible expressions" or "syntax error" errors.

Thanks,

Jan

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