Re: [Vala] array declaration
- From: Xavier Bestel <xavier bestel free fr>
- To: Frederik <scumm_fredo gmx net>
- Cc: vala-list <vala-list gnome org>
- Subject: Re: [Vala] array declaration
- Date: Thu, 08 Jul 2010 09:35:59 +0200
On Wed, 2010-07-07 at 23:07 +0200, Frederik wrote:
Am 07.07.2010 18:33, Harry Van Haaren wrote:
Hey,
Coming from a C++ background I first tried typeHere nameHere[]; too.
I noticed that newer languages seemed to have type[] name; configuration
(Java, C# etc).
Vala supports two types of arrays:
1) dynamically heap-allocated arrays:
Vala, Java, C#: int[] a = new int[5];
C++: int* a = new int[5];
C: int* a = malloc (5 * sizeof (int));
2) inline/stack-allocated fixed-size arrays:
Vala: int a[5];
C++: int a[5];
C: int a[5];
Java: not supported
C#: unsafe { int* a = stackalloc int[5]; }
There's one missing type, supported by gcc: dynamic stack-allocated
arrays:
int a[x];
Would be very nice to have.
Xav
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]