[chuck-dev] for loop, empty conditional statement, possible fix

Szilveszter Tóth silvestre.toth at gmail.com
Fri Oct 23 08:34:18 EDT 2009


Hello All,

I found that the following code crashes ChucK:

0 => int i;
for (; ; ) {
    <<<i>>>;
    if (i == 100) {
        break;
    }
    i++;
}

If I put a "true" keyword in the second part of the statement, it works.

0 => int i;
for (; true; ) {
    <<<i>>>;
    if (i == 100) {
        break;
    }
    i++;
}

I also checked out the source code and made a change which made this 
loop work:
at chuck_dev\v2\chuck_type.cpp:873:

I enclosed the switch() block in a conditional:

if (stmt->c2) { ... }

Now it seems to work.

Regards,
Szilveszter aka Hillaby


More information about the chuck-dev mailing list