[chuck-users] weird for-loop bug
eduard aylon
eduard.aylon at gmail.com
Mon Sep 3 09:22:30 EDT 2007
Hello all,
It's weird, but I think there may be a bug in for-loop's declaration
when used inside a class. Not sure it has been discussed earlier.
The code below explains it better than words. Can anyone try if it
gives a Bus Error when using myClass2? BTW, I'm using Chuck-1.2.1.0
// ***********************************
// this is ok
int i, j;
for( 0 => i => j; i < 12; 3 +=> i, j++ )
{
<<< i, j>>>;
}
// ***********************************
//this class is ok
class myClass1
{
int i, j;
for( 0 => i => j; i < 12; 3 +=> i )
{
<<< i, j++>>>; // note j is incremented here
}
}
// ***********************************
// next class is not ok: seems that declaring 2 increments at the end
of the for-loop declaration rises a Bus Error.
class myClass2
{
int i, j;
for( 0 => i => j; i < 12; 3 +=> i, j++ ) // note i and j are
incremented here and this is supposedly the problem
{
<<< i, j>>>;
}
}
myClass2 c;
eduard
More information about the chuck-users
mailing list