I think ChucK can get pretty confused about this line:<br><br>x[msg.which] =&gt; int x;<br><br>...in which x is treated both as an array and as a newly declared integer variable. I would rename the array to avoid confusion.<br>
<br>/Stefan<br><br><div class="gmail_quote">On Wed, Apr 22, 2009 at 2:04 PM, Hans Aberg <span dir="ltr">&lt;<a href="mailto:haberg@math.su.se">haberg@math.su.se</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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:<br>
  [<a href="http://bug597534.ck" target="_blank">bug597534.ck</a>]:line(22): array subscripts (1) exceeds defined dimension (0)<br>
It does not happen when the same kind of construct is used in the top loop, also as in the example code.<br>
<br>
  Hans Aberg<br>
<br>
<br>
----<br>
Hid kb;<br>
HidMsg msg;<br>
<br>
if(!kb.openKeyboard(0)) me.exit();<br>
&lt;&lt;&lt; &quot;Keyboard &#39;&quot;, <a href="http://kb.name" target="_blank">kb.name</a>(), &quot;&#39; ready.&quot; &gt;&gt;&gt;;<br>
<br>
// Key x-axis coordinate<br>
int x[256];<br>
<br>
while(true)<br>
{<br>
  kb =&gt; now;<br>
<br>
  x[msg.which] =&gt; int y;<br>
  x[msg.which] =&gt; int y0;<br>
<br>
  while(kb.recv(msg))<br>
  {<br>
    x[msg.which] =&gt; int x;<br>
    x[msg.which] =&gt; int x0;<br>
  }<br>
}<br>
----<br>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Release me, insect, or I will destroy the Cosmos!<br>