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 / Serious bug with types

Author
Message
Ratty Rat
21
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 13th Dec 2002 18:48
In the following bit of code you should see the message 'its zero!' printed, but its not.

Does this happen with anyone else?

Kale
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: United Kingdom
Posted: 13th Dec 2002 19:25
i think i ran into this in javascript! i think it is because you are trying to evaluate a boolean value against an integer?

demonstrated here:



What the flame does not consume, consumes the flame.
------------------------------------------------------------------------
AMD XP2100+, Geforce4Ti 4400, 512Mb DDR, Abit KX7, WinXP Home
ZomBfied
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 13th Dec 2002 19:29
Try saying


MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 13th Dec 2002 19:38
I think Lee should know about this...

Good news everybody! I really am THAT good...
Rubberduck
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location:
Posted: 13th Dec 2002 22:48
Hi.
Boolean Types are not buggy.



Kale
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: United Kingdom
Posted: 14th Dec 2002 00:54
what you are testing there Rubberduck is if a(0).bool exsists! even this prints "its zero!"


to compare 'a(0).bool' correctly you need to compare it to another boolean value, NOT an integer or wether it exsists or not!

it would be great if this worked with boolean types


What the flame does not consume, consumes the flame.
------------------------------------------------------------------------
AMD XP2100+, Geforce4Ti 4400, 512Mb DDR, Abit KX7, WinXP Home
Kale
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: United Kingdom
Posted: 14th Dec 2002 00:58
infact i don't think its a bug, it just should be clearer what to test boolean values with! i know in some languages there are constants with which to test it with, kinda like this:


this make more sense to me.

What the flame does not consume, consumes the flame.
------------------------------------------------------------------------
AMD XP2100+, Geforce4Ti 4400, 512Mb DDR, Abit KX7, WinXP Home
empty
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 14th Dec 2002 01:55
Hmm, this problem occurs with arrays only (not with variables).
So I guess it's a bug.

dim a(0) as Boolean
b as Boolean
a(0) = 0
b = 0
if a(0) = 0 then print "a(0) = 0"
if b = 0 then print "b = 0"
wait key

Ogres have layers.
Kale
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: United Kingdom
Posted: 14th Dec 2002 02:32
aha! i didn't notice that! yeah it looks like a bug then

What the flame does not consume, consumes the flame.
------------------------------------------------------------------------
AMD XP2100+, Geforce4Ti 4400, 512Mb DDR, Abit KX7, WinXP Home
Ratty Rat
21
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 16th Dec 2002 16:08
OK, thanks everyone, I should have spotted that, although I think there is a bit of a gap here as we don`t have the built in constants 'True' and 'False' as many other languages do and theres no way of assigning them as putting '#constant true 1' makes an integer not a boolean value.

Incidentally has anyone else noticed that you can put anything after '#constant whatever ' and it gets replaced in the code? for instance '#constant poo fecal matter' will replace 'poo' with 'fecal matter' anywhere in the code.

If you use a command over and over again you could use an abbreviation IE '#constant po position object'

Login to post a reply

Server time is: 2024-05-02 12:02:45
Your offset time is: 2024-05-02 12:02:45