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 584370 - multidimensional constant outside of main results in a warning.
multidimensional constant outside of main results in a warning.
Status: RESOLVED DUPLICATE of bug 604371
Product: vala
Classification: Core
Component: Arrays
0.7.x
Other Linux
: Normal minor
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on: 604371
Blocks:
 
 
Reported: 2009-05-31 15:49 UTC by Chris Van Vranken
Modified: 2018-02-18 08:32 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Chris Van Vranken 2009-05-31 15:49:10 UTC
using GLib;

const double[,] floorvertices = { 
{ -20.0, 0.0, 20.0 },
{ 20.0, 0.0, 20.0 },
{ 20.0, 0.0, -20.0 },
{ -20.0, 0.0, -20.0 },
};

public static int main (string[] args) {
return 0;
}

This code results in a bunch of warnings. Such as:

/home/cvanvranken/Projects/Valh/Valh/bin/Debug/main.vala.c:13: warning: braces around scalar initializer
/home/cvanvranken/Projects/Valh/Valh/bin/Debug/main.vala.c:13: warning: (near initialization for ‘floorVertices[0]’)
/home/cvanvranken/Projects/Valh/Valh/bin/Debug/main.vala.c:13: warning: excess elements in scalar initializer
/home/cvanvranken/Projects/Valh/Valh/bin/Debug/main.vala.c:13: warning: (near initialization for ‘floorVertices[0]’)

The resulting C code:
static const double floorVertices[] = {{-20.0, 0.0, 20.0}, {20.0, 0.0, 20.0}, {20.0, 0.0, -20.0}, {-20.0, 0.0, -20.0}};
Comment 1 Ilya Mezhirov 2009-12-14 09:55:55 UTC
This is a duplicate of 604371. I'm the reporter of that so I could mark it as duplicate, but I hesitate to do so because this is more than a minor bug. Try printing the floorVertices array...

Here's my code:

const uint8[,] a = {{255,255}};
void main()
{
    stdout.printf("%d\n", a[0,1]);
}

My result is 37.
Comment 2 Marco Trevisan (Treviño) 2011-01-12 19:17:21 UTC
Fixed in Bug 604371 too...
Comment 3 Rico Tzschichholz 2018-02-18 08:32:19 UTC

*** This bug has been marked as a duplicate of bug 604371 ***