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



Il giorno gio, 03/03/2011 alle 16.54 +0100, Marco Trevisan (Treviño) ha
scritto:
Il giorno mer, 02/03/2011 alle 20.33 +0000, Graham Whelan ha scritto:
int main (string[] args) {
        int a[5] = {1, 2, 3, 4, 5};
        return 0;
}

You should use:
      int[] a = {1, 2, 3, 4, 5};

Sorry I forgot const... The array should be set as constant:
        const int[] a = {1, 2, 3, 4, 5};
So the generated C code will be:
        static const gint a[5] = {1, 2, 3, 4, 5};





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