GNOME Bugzilla – Bug 584370
multidimensional constant outside of main results in a warning.
Last modified: 2018-02-18 08:32:19 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}};
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.
Fixed in Bug 604371 too...
*** This bug has been marked as a duplicate of bug 604371 ***