Microsoft KB Archive/62892

= &quot;Out of Stack Space&quot; with ON ERROR, REDIM, GOSUB, then ERASE =

Article ID: 62892

Article Last Modified on 10/20/2003

-

APPLIES TO


 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q62892



SYMPTOMS
When compiled with the far strings option (BC /FS) and run as an .EXE program, the program below results in the message &quot;Out of stack space in line 4.&quot; This problem does not occur when the program is run in the QBX.EXE environment or when it is compiled with the near strings option and run as an .EXE program. It also does not occur when lines 1 and 9 are removed, when line 4 is removed, or when the number of arrays erased is decreased by one or more.



STATUS
Microsoft has confirmed this to be a bug in Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 for MS-DOS and MS OS/2. We are researching this problem and will post new information here as it becomes available.

To work around this problem, you can add a STACK 3000 statement directly above the ERASE statement. Note that the STACK statement is allowed only at the module level (as shown in the code example below); therefore, you cannot use this workaround inside a SUB or FUNCTION procedure. A better workaround is to replace the ERASE statement with a REDIM statement to redimension the arrays again to one element.

Code Example
1 ON ERROR GOTO 9 2 FOR i% = 1 TO 100 3  REDIM a$(1), b$(1), c$(1) 4  GOSUB 8 5  ERASE a$, b$, c$   6 NEXT i%   7 END 8 RETURN 9 RESUME

Additional query words: BasicCom buglist7.00 buglist7.10 7.00 7.10

Keywords: KB62892

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.