Re: [Vala] array declaration



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 than malloc and replaces alloca in a secure way..

Vala can implement it by using slices or just simple malloc. Its not a matter of complexity. Just about 
making the code cleaner and not adding possible vulnerabilities or bugs.

----- Original message -----
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 <xavier bestel free fr>
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 break compatibility
with non-C99 compilers, like MSVC. (We are using Vala this way in
http://code.google.com/p/frida-ire/)

Not if it's implemented using alloca().

    Xav

_______________________________________________
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]