[Vala] params string[] foo?



Dear List,

How do I use the params syntax? I see it added in the parser but looks
like the codegen is not dealing with it properly, or maybe I am missing
something.

This naive code fails:

public void va(params string[] foo) {
  return;
}

public void call_va() {
  va("a", "b", "c");
}

/tmp/t.vala.c: In function ‘call_va’:
/tmp/t.vala.c:21: warning: passing argument 1 of ‘va’ from incompatible pointer type
/tmp/t.vala.c:15: note: expected ‘const char **’ but argument is of type ‘char *’
/tmp/t.vala.c:21: warning: passing argument 2 of ‘va’ makes integer from pointer without a cast
/tmp/t.vala.c:15: note: expected ‘int’ but argument is of type ‘char *’
/tmp/t.vala.c:21: error: too many arguments to function ‘va’
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)

Yu




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