Microsoft KB Archive/50638: Difference between revisions
(importing KB archive) |
m (Text replacement - "&" to "&") |
||
Line 53: | Line 53: | ||
The following code demonstrates the problem passing a dynamic array of long integers to a SUBprogram and REDIMing it in the SUBprogram. | The following code demonstrates the problem passing a dynamic array of long integers to a SUBprogram and REDIMing it in the SUBprogram. | ||
<pre class="codesample">REM $DYNAMIC | <pre class="codesample">REM $DYNAMIC | ||
DIM arrayb& | DIM arrayb&(50) | ||
CALL Test(arrayb& | CALL Test(arrayb&()) | ||
END | END | ||
SUB Test(arrayc& | SUB Test(arrayc&()) | ||
REDIM arrayc& | REDIM arrayc&(100) | ||
END SUB | END SUB | ||
</pre> | </pre> |
Latest revision as of 14:14, 21 July 2020
Article ID: 50638
Article Last Modified on 11/21/2006
This article was previously published under Q50638
SYMPTOMS
REDIMing (redimensioning with REDIM) a dynamic long integer array that was passed to a SUBprogram generates a "Subscript Out Of Range" error at run time.
STATUS
Microsoft has confirmed this to be a bug in Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50 for MS-DOS and in Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2 (buglist6.00, buglist6.00b). This problem was corrected in Microsoft Basic PDS Version 7.00 (fixlist7.00).
MORE INFORMATION
The "Subscript Out Of Range" occurs whether the SUBprogram is compiled as part of the main program or it is compiled in a separate module.
You can work around this problem by using an array type other than long integer, or by passing the array through a COMMON SHARED block.
The following code demonstrates the problem passing a dynamic array of long integers to a SUBprogram and REDIMing it in the SUBprogram.
REM $DYNAMIC DIM arrayb&(50) CALL Test(arrayb&()) END SUB Test(arrayc&()) REDIM arrayc&(100) END SUB
Additional query words: QuickBas BasicCom buglist4.00 buglist4.00b buglist4.50 B_BasicCom SR# S891016-81
Keywords: KB50638