Boolean type (as a bit)

Post your requests and ideas on the future development of mikroBasic.
Post Reply
Author
Message
Kalain
Posts: 1093
Joined: 11 Mar 2005 18:26
Location: Aubenas, France

Boolean type (as a bit)

#1 Post by Kalain » 16 Sep 2007 20:25

Hi,

mB 5.0.0.2.
Boolean type is already implemented in mb 5.0.0.2 but there is nothing much about this type in help file. ("Simple type" help file page should be more detailed about this.)
Well, by now any variable declared as boolean type, needs 8 bits.

It would be nice when a variable is declared as boolean to use only one bit and behaves like this :

Code: Select all

dim i, j as boolean
i = 0  ' or i = false
j = not(i)   'j is set to 1 or j is set to true
code as below

Code: Select all

dim i as boolean

i = 25
should return error : out of range.
Alain

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: Boolean type (as a bit)

#2 Post by zristic » 17 Sep 2007 08:40

We are preparing full boolean type for future releases.
Thanks for the tip.

oliverb
Posts: 570
Joined: 24 May 2007 15:09

#3 Post by oliverb » 02 Oct 2007 12:03

If you're looking into how logic is implemented then it might be a good idea to look into the return values from bit tests, which appear to return 0 for clear and 1 for set which is not the same as "true". I'm NOT saying they need to change it but its a big gotcha as the condition
if not port.bit
always executes.

Nudge
Posts: 49
Joined: 23 Nov 2007 01:24
Location: Australia

Re: Boolean type (as a bit)

#4 Post by Nudge » 22 Dec 2007 10:02

zristic wrote:We are preparing full boolean type for future releases.
Thanks for the tip.
While on the bool, can we also have array of boolean?
-
Nudge

Post Reply

Return to “mikroBasic Wish List”