Hi,
When using this code:
|public delegate void SampleFunc (int a, out int x);
|
|void f1 (int a, out int x) {
| print ("a %d\n", a);
| x = a * 10;
|}
|
|void f2 (SampleFunc func, int a) {
| int x;
| func (a, out x);
| print ("x %d\n", x);
|}
|
|static int main (string[] args) {
| /* Passing a function */
| f2 (f1, 5);
| /* Using a lambda */
| f2 ( (a, x) => {
| print ("lambda a %d\n", a);
| x = a * 10;
| }, 5);
| return 0;
|}
the lamdba function isn't working because instead of passing gint *x
it passes gint x. Here is the error message:
|/tmp/lambda-out-parameters.vala.c: In function ‘__lambda0__sample_func’:
|/tmp/lambda-out-parameters.vala.c:46: attention : passing argument 2
of ‘_lambda0_’ makes integer from pointer without a cast
|/tmp/lambda-out-parameters.vala.c:39: note: expected ‘gint’ but
argument is of type ‘gint *’
This is with Vala 0.7.1, I don't have 0.7.2 yet as I isntall from
packages. Should I open a bug report?
Cheers
Mike
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list