<div>Hi,</div><div><br></div>array.size(int) and the '<<' operator are crashing miniAudicle (version 0.2.0, on Windows 7 pro).  (functionality added to chuck in 1.2.1.2, 
<a href="http://chuck.cs.princeton.edu/release/VERSIONS">http://chuck.cs.princeton.edu/release/VERSIONS</a> ).  miniAudicle tells me it's running chuck 1.2.1.2.<div><br></div><div>the following code produces a "NullPointerException" error</div>
<div><div><br></div><div>int ar[];</div><div>ar.size(10); // crashes here,  "NullPointerException: shred[id=1:*unnamed3], PC=[5]"</div><div>for (0 => int i; i < 4; i++) {</div><div>    ar << i; // crashes here, "NullPointerException: (array append) in shred[id=1:*unnamed3], PC=[13]"</div>
<div>}</div><div><br></div><div>playing around a bit, I now find that if I follow what the example <a href="http://array_dynamic.ck">array_dynamic.ck</a> says and replace "int ar[]" with "int ar[0]", then the code works.  I guess that means this isn't a bug but a meaningful difference between ar[] and ar[0]?  In any case, I might amend the <a href="http://array_dynamic.ck">array_dynamic.ck</a> to say something like</div>
<div>"<span style="white-space:pre-wrap">float argh[0]; // must set argh[0] and not argh[]"</span></div><div><br></div>Thanks again,</div><div>George</div><div><br><div class="gmail_quote">On Fri, Jul 27, 2012 at 12:44 PM, George Locke <span dir="ltr"><<a href="mailto:george.locke.maxmsp@gmail.com" target="_blank">george.locke.maxmsp@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">thanks!<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">On Fri, Jul 27, 2012 at 10:31 AM, Julien Saint-Martin <span dir="ltr"><<a href="mailto:julien.saintmartin@googlemail.com" target="_blank">julien.saintmartin@googlemail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi George,<br><br>You can check examples in Chuck installation directory: \examples\array\<a href="http://array_resize.ck" target="_blank">array_resize.ck</a> and <a href="http://array_dynamic.ck" target="_blank">array_dynamic.ck</a><br>

Personally I use:<br>
array.size(new_size);<br>or<br>array << new_element; // to add an element.<br><br>Happy chucking,<br>Julien<br><br><br><div class="gmail_quote">2012/7/27 George Locke <span dir="ltr"><<a href="mailto:george.locke.maxmsp@gmail.com" target="_blank">george.locke.maxmsp@gmail.com</a>></span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Hi,<div><br></div><div>I am creating an array, but i don't know how big I need it to be at the time it is instantiated.  Once I figure out what I want that size to be, how do I assign it?  The current solution i have is this:</div>



<div><br>
</div><div>int array[];</div><div>int size;</div><div>// do stuff</div><div>{ // new block keeps dummy from clogging namespace</div><div>int dummy[size];</div><div>dummy @=> array;</div><div>}</div><div><br></div><div>



Is there a better way?</div><div><br></div><div>Regards,</div><div>George</div>
<br></div></div><div>_______________________________________________<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>
<br></div></blockquote></div><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>
<br></blockquote></div><br>
</div></div></blockquote></div><br></div>