[chuck-users] variables and memory

mike clemow gelfmuse at gmail.com
Sat Mar 21 17:49:57 EDT 2009


Kassen,

I've often seen this type of thing...

0 => int i;

for(0 => i; i < 10; i++ )
{
    // stuff
}

for(0 => i; i < 10; i++ )
{
    // more stuff
}

just keep reusing the same iterator integer, which I assumed you were
talking about earlier.

Also, this is going to be a lot more important for object references
and large arrays, etc.  but it's neat trick that I didn't know about
before

_mike

2009/3/21 Kassen <signal.automatique at gmail.com>:
> Mike;
>
>>  Όλα Καλά!!
>
> I'll assume that translates to "w00t"? :¬D
>
> Three cheers for Eduard!
>
> This won't work on floats and ints though ( for strings it's fine). Arrays
> of length 1, on the other hand, can be dealt with in this way if we really
> urgently must clean up everything.
>
> Sadly that will make for loops look like this;
>
> for (int n[1]; n[0] <= 5; n[0]++)
>     {
>     <<<n[0]>>>;
>     if( n[0] == 5) {null @=> n; break;}
>     }
>
> That's not going to win any beauty awards. Ahum.
>
> Kas.
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>



-- 
http://michaelclemow.com
http://semiotech.org


More information about the chuck-users mailing list