Boolean DataType

Mehyar

Well-known member
Joined
Jun 9, 2003
Messages
371
Location
Lebanon
Today is a sad day because I am a little bit disappointed about VB.NET . I always thought that boolean variables are bits but now I discovered that they are 2 bytes (16 bits) !!!!

What do u need more than a 1 and a 0 for a boolean.

Please enlighten me..
 
Originally posted by Mehyar
Today is a sad day because I am a little bit disappointed about VB.NET . I always thought that boolean variables are bits but now I discovered that they are 2 bytes (16 bits) !!!!

What do u need more than a 1 and a 0 for a boolean.

Please enlighten me..

Faster chips and processors are the source of it. Were emerging with technology to 64-bit processors. FYI, You can still declare a short integer in VB.Net.
 
If you want to store many boolean values (1 and 0) in one variable, you can look at storing flags as bits inside an Integer. In one Integer you can store 32 on/off values by using bitwise operators to set each of the 32 bits individually.

Theres not really much of an advantage over using an array of Booleans though, other than its easier to store.
 
Back
Top