"Out of Stack Space" with ON ERROR, REDIM, GOSUB, then ERASE (62892)
The information in this article applies to:
- Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0
- Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 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 "Out of stack space
in line 4." 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
Modification Type: | Major | Last Reviewed: | 10/20/2003 |
---|
Keywords: | KB62892 |
---|
|