How to Restart a Bogged Down Program
#10
If the SUB-program is the only one being called by the main program, why declare large arrays globally? If it's not needed by main module-level code, then could declare such arrays with STATIC inside the SUB. However, then you would have to initialize it the first time the SUB is called, or when the user of the program "goes back to the beginning".

Otherwise if it's a few variables to share between main program and SUB, and only the large arrays declared globally then everything has been already said here.

If there's only one SUB which involves changing values from a large array, you have to be very careful about those changes. The indexes (subscripts) of the arrays might be going out of bounds. I forgot how to get QB64 to compile with "debug" information enabled so the program returns a runtime error at a subscript less than LBOUND() and greater than UBOUND().

It's easy to be confused by a statement such as LOCATE when the user wants "array(x,y)" and LOCATE terminally insists in "y, x" or "row, column". Then it would be easy to track an out-of-range error when there are way more columns across the screen than rows.
Reply


Messages In This Thread
RE: How to Restart a Bogged Down Program - by mnrvovrfc - 04-21-2023, 08:54 PM
RE: How to Restart a Bogged Down Program - by jcm - 04-23-2023, 03:00 AM



Users browsing this thread: 7 Guest(s)