Re: [Vala] Can fixed-size arrays be initialized?



On 3 Mar 2011, at 18:05, "Marco Trevisan (Treviño)" <mail 3v1n0 net> wrote:

Il giorno gio, 03/03/2011 alle 17.34 +0000, Graham Whelan ha scritto:
dynamic array syntax:
const int[] a = {1, 2, 3}; /* compiles*/

This is not dynamic at all! It's constant; look at the generated C code!

Yes, you are completely correct. My language was clumsy. I was only
trying to distinguish between the two different syntaxes for declaring
arrays.


int a[] = {1, 2, 3};       /* does not compile */

Yes, because in this case the type is int, not int[].

So are saying that the above code (which is valid in C) is not
supported in Vala?

However it could
be added an alias to const int a[] = {1, 2, 3};.

Do you mean aliasing "int a[] = {1, 2}" to "const int a[] = {1, 2}"?
Surely they are declaring very different things.



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