Microsoft KB Archive/84929

= Integer &quot;Overflow&quot; Using SETMEM in Basic PDS and QuickBasic =

Article ID: 84929

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q84929



SUMMARY
The SETMEM function in Basic returns the amount of memory available to Basic after any re-allocation from the SETMEM occurs. If you inadvertently try to assign this return value to an integer variable, an &quot;Overflow&quot; error may occur. The return value from SETMEM is a long integer, and may have a value greater then 32,767 (the maximum value for an integer variable).

This would normally only occur if you have a DEF type defined somewhere in your program, such as a DEFINT. A typing of the specific return variable would be required in this case.



MORE INFORMATION
If the following two lines of code are entered into QBX.EXE or QB.EXE, an &quot;overflow&quot; error will likely occur. DEFINT A-Z X = SETMEM(-1024) The workaround is to either not use the DEFINT statement, or to use the following command for the SETMEM; X# = SETMEM(-1024)

Additional query words: QuickBas BasicCom 4.50 7.00 7.10

Keywords: KB84929

-

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

© Microsoft Corporation. All rights reserved.