After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 492481 - needs "int[100] myarray;" syntax for direct allocation
needs "int[100] myarray;" syntax for direct allocation
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Arrays
0.3.x
Other All
: Normal minor
: ---
Assigned To: Jürg Billeter
Vala maintainers
: 522003 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-11-01 21:16 UTC by xavier.bestel
Modified: 2009-04-10 15:06 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description xavier.bestel 2007-11-01 21:16:51 UTC
There's a need for directly embedding fixed-size arrays in struct/class or on the stack. Preferred syntax is:

int[100] myarray;
Comment 1 Jürg Billeter 2007-11-03 20:38:07 UTC
Yes, this makes sense, in my opinion. It might be a bit problematic grammar-wise for local variables but it should be semantically conflict-free.
Comment 2 Jürg Billeter 2008-03-15 00:46:48 UTC
*** Bug 522003 has been marked as a duplicate of this bug. ***
Comment 3 Maciej (Matthew) Piechotka 2008-03-15 08:30:25 UTC
Will it be possible to use int[some_function ()] myarray; for alloca call?

Comment 4 Arc Riley 2009-03-24 14:53:57 UTC
I've hit this problem as well.

The lack of fixed-size stack arrays is a language deficiency that should be solved soon.  It should not be impossible to cause Vala to generate basic C syntax such as "float Quaternion[4];".
Comment 5 Jürg Billeter 2009-04-10 15:06:50 UTC
commit e065e581748863cb7c90fabb2bb39d6671dfbe8f
Author: Jürg Billeter <j@bitron.ch>
Date:   Fri Apr 10 17:02:22 2009 +0200

    Arrays: Add experimental support for fixed-length arrays
    
    Local fixed-length arrays are allocated on the stack.
    
        int[3] array = { 1, 2, 3 };
    
    Fixes bug 492481.