Microsoft KB Archive/11697

= Integer "Overflow" Is Not Trapped without /D Debug Switch =

Article ID: 11697

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b

-



This article was previously published under Q11697



SUMMARY
The following program returns the error "Overflow in line 20 of module at address xxxx:xxxx" when compiled with the /D switch: 10 x% = 129 20 print 256 * x%   30  end If the sample program is compiled without the /D switch, no error is reported, but an incorrect (negative) value is returned.

Forcing "256" to single precision by using 256! or 256.0 will eliminate the overflow error. "256" is an integer, and the result of 129 times 256 is greater than 32,767, which is the highest integer allowed.

This information applies to Microsoft QuickBasic Versions 1.00, 1.01, 1.02, 2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50 for MS-DOS and to Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2.

These compilers don't handle type coercion, nor do they check for overflow unless the program was compiled with the /D switch.

Additional query words: QuickBas BasicCom

Keywords: KB11697

-

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

© Microsoft Corporation. All rights reserved.