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 782101 - Attempt to initialize variable-sized arrays
Attempt to initialize variable-sized arrays
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Basic Types
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2017-05-03 08:18 UTC by Andrei Zisu
Modified: 2018-05-22 15:49 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andrei Zisu 2017-05-03 08:18:38 UTC
The following snippet: 

const int width = 50;
const int height = 50;
uint8 drawbuf[width*height*3];

Vala attempts to transform into the following code: 

guint8 drawbuf[(width * height) * 3] = {0};

Throwing the following error: "variable-sized object may not be initialized", perhaps due to the {0} added there. 


Vala 0.34.7
Comment 1 Rico Tzschichholz 2017-05-03 09:48:08 UTC
You may not define your constants inside a method-block.
Comment 2 GNOME Infrastructure Team 2018-05-22 15:49:19 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/586.