QB.EXE /AH Hang/"String Space Corrupt" Static to Dynamic Array (80824)



The information in this article applies to:

  • Microsoft QuickBASIC 4.5
  • Microsoft Basic Professional Development System for MS-DOS 7.1

This article was previously published under Q80824

SYMPTOMS

If you try to convert a static array to a huge dynamic array after a "Subscript Out of Range" error on the static array in the QB.EXE environment, you may receive a "String Space Corrupt" error or hang the system.

STATUS

Microsoft has confirmed this to be a bug in the QB.EXE environment in Microsoft QuickBasic version 4.5 for MS-DOS. This problem was corrected in the QBX.EXE environment in Microsoft Basic Professional Development System (PDS) version 7.1 for MS-DOS (fixlist7.10).

MORE INFORMATION

Starting the QuickBasic environment (QB.EXE) with the /AH (huge arrays) option allows dynamic non-variable-length string arrays to be larger than 64K. To make a huge array (an array greater than 64K), you must use the REM $DYNAMIC metacommand to force the array to use dynamic or far memory.

A problem occurs if you try to create a huge array and forget the REM $DYNAMIC metacommand. When you run the program, you will get a "Subscript Out of Range" error. When trying to fix the problem by adding the REM $DYNAMIC statement, you can get a "String Space Corrupt" error or hang the system.

Steps to Re-create Problem

  1. Invoke the QuickBasic environment with the /AH option to allow huge arrays.
  2. In the QuickBasic environment, dimension an array as follows:
          DIM A(20000)
    						
  3. From the Run menu, choose Start, or press F5, to start the program. You will receive a "Subscript Out of Range" error.
  4. On the line just before the DIM (dimension) statement place the REM $DYNAMIC metacommand.
  5. Now run the program, and either you will receive a "String Space Corrupt" error, or your system will hang, or the results may be unpredictable.

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB80824