Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BUG!!!???? in QBASIC 1

Status
Not open for further replies.

Pappy1942

Technical User
Nov 2, 2000
69
US
Hi,

On another board I came across post about an overflow error that came up in a long program.

I reduced it to this

REM TEST
A& = 40000 REM NO OVERFLOW ( & indicates LONG)
A& = 4 * 10000 REM OVERFLOW


Has any one seen this? Is there a work around? Why does it happen?

Pappy
 
I think why it produces an error is that the 4 and the 10000 are treated as integers (because there is not declaration on them) which will produce an integer out of range. This calcualtion is done before it is assigned to the long variable 'a&'. With the 10000 declared as a long it does not produce the error.
David Paulson


 
Hi,

I also found that

tenthou = 10000
a& = (4 * tenthou)

worked.

In M$ parlance this isn't a BUG it's a FEATURE.

Pappy

BTW Thanks for the quick responce.
 
Pappy1942:

Just a quick note (pun intended)

By using "tenthou" and NOT HAVING A NUMERIC DEFINITION (ex: defint A-Z), QB is set to default to SINGLE numerical definition.


------------------------------
If you have QB 4.5 or better test this out:

[red]'write this to your screen
tenthou = 10000[/red]

then move the cursor to TENTHOU and press F1, when you're done press ESC key.


-------------------------------
then add this before that line:

[red]DEFINT T[/red]

then move the cursor to TENTHOU and press F1, when you're done press ESC key.


see what I mean?

--MiggyD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top