Re: [Vala] array declaration

2010-07-08 Thread pancake
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

Re: [Vala] array declaration

2010-07-08 Thread Bob Hazard
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-al

Re: [Vala] array declaration

2010-07-08 Thread pancake
Good C coding practices does not allow to use alloca or dynamically stack allocated arrays because alloca does not specifies what happens when you allocate -1 bytes (or somewhat bigger than the stack assigned to the running thread. I wrote a stackbased allocator which performs 3 times faster th

Re: [Vala] array declaration

2010-07-08 Thread Xavier Bestel
On Thu, 2010-07-08 at 10:45 +0200, Ole André Vadla Ravnås wrote: > Hi, > > On Thu, Jul 8, 2010 at 9:35 AM, Xavier Bestel wrote: > > On Wed, 2010-07-07 at 23:07 +0200, Frederik wrote: > (...) > > > > There's one missing type, supported by gcc: dynamic stack-allocated > > arrays: > > > > int a[x];

Re: [Vala] array declaration

2010-07-08 Thread Ole André Vadla Ravnås
Hi, On Thu, Jul 8, 2010 at 9:35 AM, Xavier Bestel wrote: > On Wed, 2010-07-07 at 23:07 +0200, Frederik wrote: (...) > > There's one missing type, supported by gcc: dynamic stack-allocated > arrays: > > int a[x]; > > Would be very nice to have. Although a nice feature, please don't. It would brea

Re: [Vala] array declaration

2010-07-08 Thread pancake
Should I open a bug? or there's somebody already looking at this issue? On 07/07/10 23:07, 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; c

Re: [Vala] array declaration

2010-07-08 Thread Xavier Bestel
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

Re: [Vala] array declaration

2010-07-07 Thread Frederik
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

Re: [Vala] array declaration

2010-07-07 Thread Seth Hoenig
My opinion matter not, but it makes more sense to me to force the ' type[] name = new type[] ' syntax. Not only does it make more phonetic sense, but it also eliminates ambiguity when using the 'var name = new type[]' syntax. (If the other syntax were allowed, would var name[] = new type[] be corr

Re: [Vala] array declaration

2010-07-07 Thread Harry Van Haaren
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). I'm not part of the Vala team though, so I dont know the "official" status! -Harry On Wed, Jul 7, 2010 at 5:15 PM, pancake wr

[Vala] array declaration

2010-07-07 Thread pancake
I have noticed that if you declare an array in a wrong way you get errors from the C compiler instead of handling it at vala level. should this syntax be supported? or we should just throw an error? Here's the test case: $ cat a.vala #!/usr/bin/vala void main () { // uint8[] foo = new