Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Bug: Byte, Word, DWord, etc

Author
Message
Vermis
23
Years of Service
User Offline
Joined: 21st Apr 2003
Location: United States
Posted: 25th Apr 2003 08:36 Edited at: 25th Apr 2003 08:38
I dunno if someone has mentioned this before or not (I hope I'm not the first to bang my head against it anyways). btw, why is there no SEARCH function on this forum? How do you guys prevent people from asking the same stuff again and again???

Apparently the datatypes BYTE, WORD, and DWORD are broken (maybe others, didn't check). It looks to me that DBPro is using the wrong internal tmp variable for any expression involving these types. Also, if you use a smaller type like BYTE it will cast the result of the expression as a byte, even if the expression results in a number that is too big for a byte.

This was observed in DBPro with Patch 4 and the following code demonstrates the bug.




The Wendigo
23
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 25th Apr 2003 09:20
Quote: "btw, why is there no SEARCH function on this forum? How do you guys prevent people from asking the same stuff again and again???"


We dont' have any preventions. I've done it several times myselft .

To answer your other question, yes there is a big glitch there. It is a fat pain in the rear but we'll just have to deal with it till they fix it. If you are doing file saving I can help you from pulling your hair out like i did. Never use WORDS or BYTES when reading/writing to files. You always will have to use integers (which take up 4 bytes in DBP). It really sucks as I usually have values which can be expressed under 255, but that is life right now. I do seriously hope they do something though.

1.00 GHZ processor, 256 MB RAM, GeForce 3 64MB, SB Live!, 8 cans of soda per day
Vermis
23
Years of Service
User Offline
Joined: 21st Apr 2003
Location: United States
Posted: 25th Apr 2003 10:29
Quote: "It really sucks as I usually have values which can be expressed under 255, but that is life right now."

That's pretty much what I was doing. I was in the mind-set of saving some memory when building my TYPES ... Well it sure as hell wasn't worth the frustration of trying to figure out why half of my expressions were possessed and evaluated to weird things.

Another thing of DBPro that I don't quite understand is variable scope. Being an experienced programmer it has really thrown me for a loop so far. From playing around with it it seems like the scope is hierarchical starting with the "main file". All variables in the "main file" trickle down to any included files. While variables in the include files don't trickle up to the main file.

Is this how it works, or am I missing something here?

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Apr 2003 10:34
Yes, there is a problem there.

The first comparison is treating Var2 as a signed number in the comparison - so 60000 is being seen as -5535 (I think )

The second problem is that the result of the calculation (byte * number) is being treated as a byte still.

Maybe all byte and word calculations should be carried out at integer calculations?
Lee Bamber
23
Years of Service
User Offline
Joined: 12th Sep 2002
Location:
Posted: 24th Jun 2003 08:34
Fixed for U5 coming soon. The calculation is now held in a DWORD just in case two large WORDs come along. If you are curious why I am posting here, the email containing the bug I have just fixed contained this link. And I always let you know when I have fixed one of your bugs

Best Regards,
Lee Bamber

Login to post a reply

Server time is: 2026-07-18 09:23:58
Your offset time is: 2026-07-18 09:23:58