gavr
(gavr)
1
Why thats is possible
void func (Variable v){...}
int[]a = {1,2,3};
func(a);
and thats give an error, is that a bug?
func({1,2,3});
error: initializer list used for 'GLib.Variant', which is neither array nor struct
when
void func (int[] arr){...}
func({1,2,3});
works fine
chrisaw
(Chris Williams)
2
An initializer list doesn’t have a type, so this code:
var a = {1,2,3};
fails with:
error: initializer list used for unknown type
You need to use the full array instantiation syntax when not assigning to an array or struct type:
var a = new int[] {1,2,3};
1 Like
system
(system)
Closed
3
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.