GNOME Bugzilla – Bug 519597
Passing array from method call as argument breaks array length
Last modified: 2008-11-12 20:48:04 UTC
Test case: class Test { public static void foo(char[] bar) { GLib.stdout.printf("%d\n", bar.length); } public static char[] bar() { return new char[16]; } public static int main(string[] args) { var baz = bar(); foo(baz); foo(bar()); return 0; } } nemequ@desktop:~$ ./test 16 0 Generated C: test_foo ((_tmp3 = test_bar (&_tmp2)), _tmp2); Instead, the C code should be as follows, as C doesn't guarantee that function arguments are evaluated in a specific order: ((_tmp3 = test_bar (&_tmp2)), test_foo (_tmp3, _tmp2));
2008-03-01 Jürg Billeter <j@bitron.ch> * gobject/valaccodegeneratorinvocationexpression.vala: fix argument dependency in the C code for array and delegate arguments, fixes bug 519597 * tests/arrays.vala: test array argument Fixed in r1073.