Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/38069

From BetaArchive Wiki
Knowledge Base

"Division By Zero" Dynamic, Fixed-Length STRING*1, 64K+ Array

Article ID: 38069

Article Last Modified on 11/21/2006


  • 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

This article was previously published under Q38069


A DIM statement gives the following error at run time when you dimension a dynamic, fixed-length STRING*1 array 64K or larger (which requires compiling with the /AH option):

"Division by zero"


Microsoft has confirmed this to be a bug in QuickBasic Versions 4.00, 4.00b, and 4.50 and in Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2 (buglist6.00, buglist6.00b). The "Division by zero" error occurs both in the QB.EXE editor and in a compiled .EXE program. This problem was corrected in Microsoft Basic PDS Version 7.00 (fixlist7.00).

This problem does not occur with static fixed-length STRING*1 arrays, or any static or dynamic array smaller than 64K.


The following is a code example:

' This program must be compiled with the /AH option.
' A static array (limited to 64K or smaller) is ok:
DIM darray(1 TO 4096, 1 TO 16) AS STRING * 1
' A dynamic, STRING*1, 64K+ array gives "DIVISION BY ZERO" at run time:
DIM carray(1 TO 4096, 1 TO 16) AS STRING * 1

Additional query words: QuickBas BasicCom buglist4.00 buglist4.00b buglist4.50 B_BasicCom

Keywords: KB38069