[chuck-users] weird for-loop bug

Ge Wang gewang at CS.Princeton.EDU
Mon Sep 3 21:22:36 EDT 2007


Hi Eduard and all,

Thanks for narrowing this down and reporting it!  We have repro bug,  
and have tracked it down to incorrect handling of multi-expression on  
the third clause in for loop statements.  The happens both inside and  
out of class definitions, but is more crash-prone when inside the  
class.  The fix is in CVS.  Anyone else notice anything else fishy  
with new release (aside from known bugs)?  If there is enough cause,  
we may do an incremental release.

Thanks again!

Best,
Ge!

On Sep 3, 2007, at 9:22 AM, eduard aylon wrote:

> 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
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users



More information about the chuck-users mailing list