[chuck-users] array declaration bug

eduard aylon eduard.aylon at gmail.com
Tue Nov 11 06:07:56 EST 2008


Hello list,

I found out that declaring arrays in this way:

float a[], b[];

is buggy, as it seems the type for b[] is not taken as float. Maybe  
something else happens here (maybe passing by ref), I haven't check  
thoroughly (don't know if it happens with other types as well). See  
the following code:


// *******************************
// this works:
// *******************************
float freq, amp;

fun void Do( float freq, float amp)
{
   <<<"do sthg">>>;
}

Do(freq,amp);

// *******************************
// also works: arrays declared in separate lines
// *******************************

float freq1[1];
float amp1[1];

fun void Do( float freq[], float amp[])
{
   <<<"do sthg">>>;
}

Do(freq1,amp1);

// *******************************
// throws error :argument type(s) do not match
// arrays declared in the same line
// *******************************

float freq2[1], amp2[1];

Do(freq2,amp2);



More information about the chuck-users mailing list