Re: [Vala] array declaration



 18:46 < pancake>  https://bugzilla.gnome.org/show_bug.cgi?id=623856
18:48 < pancake> https://bugzilla.gnome.org/show_bug.cgi?id=623857

On 07/08/10 18:49, Bob Hazard wrote:
Thanks Frederik that explains why you can't pass a fixed size array as
a parameter.

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]; }


@pancake: 'new' combined with the latter type of array does not make
sense, since the 'new' keyword stands for dynamic alloation on the
heap. The Vala compiler should refuse to compile something like
'int a[] = new int[5]'. So it's obviously a bug.
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list





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