If a function defined as returning a value doesn't return a value, it crashes after a number of invocations. Here's an example from the Coursera class forum:
fun int boom (int inInt)
{
<<< "x" >>>;
}
// this works fine
boom(1);
//This runs fine setting limit to 1,2, or 3
3 => int limit;
for (0 => int i; i < limit; i++)
{
boom(i);
}
/*
// remove comments if you want to crash!
//This goes BOOM! CRASH!
4 => limit;
for (0 => int i; i < limit; i++)
{
boom(i);
}
*/
This is fixed by either declaring the function as fun void boom or adding the line return 0; to the end of the function.
If a function defined as returning a value doesn't return a value, it crashes after a number of invocations. Here's an example from the Coursera class forum:
This is fixed by either declaring the function as
fun void boom
or adding the linereturn 0;
to the end of the function.The code does not crash under OS X.
OS X 10.8.5 miniAudicle 1.3.0 ChucK 1.3.2.0
Windows 7 miniAudicle 1.3.1 ChucK 1.3.3.0