Re: [Vala] Can fixed-size arrays be initialized?
- From: Marco Trevisan (Treviño) <mail 3v1n0 net>
- To: vala-list gnome org
- Subject: Re: [Vala] Can fixed-size arrays be initialized?
- Date: Thu, 03 Mar 2011 19:04:55 +0100
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!
int[] a = {1, 2, 3}; /* compiles */
fixed-size array syntax:
const a[] = {1, 2, 3}; /* compiles */
Including the type:
const int a[] = {1, 2, 3};
it's exactly equal to:
const int[] a = {1, 2, 3};
And they both are constant.
int a[] = {1, 2, 3}; /* does not compile */
Yes, because in this case the type is int, not int[]. However it could
be added an alias to const int a[] = {1, 2, 3};.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]