[chuck-users] Object array initialization

joerg piringer joerg at piringer.net
Thu Jul 13 12:20:06 EDT 2006


i think there's general problem with object array initialization.
i also experienced problems with it that were solved when i declared 
each element of the new array as a single variable and the @=> to the 
array-elements.
instead of

obj o[4];

i had to write:
obj o1;
obj o2;
obj o3;
obj o4;

obj @ o[4];
o1 @=> o[0];
o2 @=> o[1];
...

best
joerg

Ollie Glass wrote:
> I'm trying to declare an object array and initialize it later in a  
> function:
> 
> 	Channel channels[];
> 	initChannels(4, 16);
> 	
> 	fun void initChannels(int num, int length) {
> 			Channel ch[num] @=> channels;
> 			...
> 
> This gives a segmentation fault, and trying like this:
> 
> 	fun void initChannels(int num, int length) {	
> 			channels[num];
> 
> gives a bus error. How should this be done?
> 
> Thanks always,
> 
> Ollie
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users


-- 
http://joerg.piringer.net
http://www.transacoustic-research.com
http://www.iftaf.org
http://www.vegetableorchestra.org/


More information about the chuck-users mailing list