Menu

#81 OnBC: Bad nested loop generation

OnBoard_C
open
nobody
OnBoard C (33)
7
2005-07-03
2005-07-03
No

Eep, OnBoardC messes up nested for loops in certain
cases. This is a very strange bug. If you do not
include the first argument (for(1st; 2nd; 3rd) {...})
then it runs for ceil(n/2) where n the limiting number.
However putting a function call or a variable
declaration before the inner loop makes it work.

for(int i=0; i<5; i++) //i.e. if it does fail, the
number of times it runs here is 2,
{
//FrmHelp(1);

for(; 0; 1) break;

//--------
//note that a function call here after the loop
doesn't fix it
FrmHelp(2);
}

See the attached code for more cases (choose 'about
BadLoop' to run it). Tested with OnBC 2.4.1m

Discussion

  • Nick Guenther

    Nick Guenther - 2005-07-03
    • priority: 5 --> 7
     
  • Nick Guenther

    Nick Guenther - 2005-07-03

    Project file

     
  • Nick Guenther

    Nick Guenther - 2005-07-03

    Rsrc file

     
  • Jerramy Gipson

    Jerramy Gipson - 2006-09-25

    Logged In: YES
    user_id=1048900

    I encountered the same thing recently. The following did
    something utterly strange:

    <PRE>
    UInt16 array2D[10][10];
    void func()
    {
    int i = 0;
    int j = 0;
    for (;i < 10; ++i)
    for (;j < 10; ++j)
    func2(array2D[j][i]);
    }
    </PRE>

     

Log in to post a comment.

MongoDB Logo MongoDB