Microsoft KB Archive/31301

= Subscript Out of Range Can Hang .EXE without /d Debug Option =

Article ID: 31301

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0

-



This article was previously published under Q31301



SUMMARY
In an .EXE program compiled without the debug option (BC /d), a reference to an out-of-range array element can hang the machine. This occurs only in a compiled .EXE program.

The QB.EXE editor correctly reports the &quot;subscript out of range&quot; error because the debug option is automatically active by default.

This information applies to QuickBasic Versions 4.00, 4.00b, and 4.50, to Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and OS/2, and to Microsoft Basic PDS Version 7.00 for MS-DOS and MS OS/2.

The &quot;subscript out of range&quot; error message is documented on Page 501 of the &quot;Microsoft QuickBasic: Basic Language Reference.&quot; The /d (debug) option is documented on Page 210 of &quot;Microsoft QuickBasic: Learning to Use.&quot;



MORE INFORMATION
When a program is compiled with the BC /d (debug) option, the error will be reported at run time.

If the following program is compiled to an .EXE file without the BC /d option, it will hang the machine at run time: DIM x$(3) OPEN &quot;junk&quot; FOR RANDOM AS 1 LEN = 200

FOR i% = 0 TO 10 FIELD 1, i% * 10 AS pad$, 10 AS x$(i%) NEXT i%

FOR i% = 0 TO 10 LSET x$(i%) = &quot;fld &quot; + STR$(i%): PRINT x$(i%) NEXT i%

Additional query words: QuickBas

Keywords: KB31301

-

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

© Microsoft Corporation. All rights reserved.