[Vala] Can fixed-size arrays be initialized?



Hi,

I'm getting a compilation error when trying to initialize a fixed-size array.

/* array-test.vala */
int main (string[] args) {
        int a[5] = {1, 2, 3, 4, 5};
        return 0;
}


$ valac array-test.vala
array-test.vala:3.6-3.27: warning: local variable `a' declared but never used
        int a[5] = {1, 2, 3, 4, 5};
            ^^^^^^^^^^^^^^^^^^^^^^
/home/graham/array-test.vala.c: In function ‘_vala_main’:
/home/graham/array-test.vala.c:26: error: incompatible types when
assigning to type ‘gint[5]’ from type ‘gint *’
error: cc exited with status 256
Compilation failed: 1 error(s), 1 warning(s)


Is this a bug?

Graham



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