[chuck-users] Crash whit array

lucas samaruga samarugalucas at gmail.com
Sun Jun 8 17:33:42 EDT 2008


Hi

This code produce a crash on linux with chuck-alsa. Maybe the "logic" is not
right but the crash exist.


class Foo {}

fun void appendCap( Foo arr[], int n ) {
    Foo @ aux[ arr.cap() + n ];

    for( int i; i < arr.cap(); i++ ) {
        arr[i] @=> aux[i];
    }

    aux @=> arr;
}

Foo @ vars[5];
for( int i; i < vars.cap(); i++ ) <<< vars[i] >>>;

appendCap( vars, 5 );
//<<< vars[4] >>>;
<<< vars.cap() >>>;

<<< "End" >>>;

/* this work fine
fun Foo[] append( Foo arr[], int n ) {
    Foo @ aux[ arr.cap() + n ];

    for( int i; i < arr.cap(); i++ ) {
        arr[i] @=> aux[i];
    }

    return aux;
}
*/


Yours
Lucas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080608/b9479ed4/attachment.htm>


More information about the chuck-users mailing list