[chuck-users] Inner loop array index bug

Hans Aberg haberg at math.su.se
Wed Apr 22 08:04:11 EDT 2009


I encountered what looks like a bug. In the sample code below, the  
array indexing in the line with the assignment of x0 causes the  
following error:
   [bug597534.ck]:line(22): array subscripts (1) exceeds defined  
dimension (0)
It does not happen when the same kind of construct is used in the top  
loop, also as in the example code.

   Hans Aberg


----
Hid kb;
HidMsg msg;

if(!kb.openKeyboard(0)) me.exit();
<<< "Keyboard '", kb.name(), "' ready." >>>;

// Key x-axis coordinate
int x[256];

while(true)
{
   kb => now;

   x[msg.which] => int y;
   x[msg.which] => int y0;

   while(kb.recv(msg))
   {
     x[msg.which] => int x;
     x[msg.which] => int x0;
   }
}
----


More information about the chuck-users mailing list