16-bit boolean???

wildfire1982

Well-known member
Joined
Oct 23, 2003
Messages
50
Location
Southampton
I have just decided to change from vb6 to vb.net and so i thought i would have a quick read of the very good post in the tutor section about the differences.

All very good but i couldnt help but notice the variable size for boolean. Is there a reason for the boolean data type being 16-bit? seems a bit excessive to me.
 
Thats the size they are in VB6 too. In C++ they are 8 bits.

Worrying about the size of varaibles is silly, since you have millions of bytes available to you. An extra one byte per boolean wont make a noticable difference.
 
Oh i wasnt worried about it, i was just curious. It just seems a little odd to me. I suppose its easier to code for a byte or two rather than a bit which would really be all that is needed.

I had never actually looked at the size in vb. Still, makes not a lot of sense but it doesnt change anything so what does it matter....
 
Suffice it to say that it is computationally easier to use two 8-bit fields (2 bytes) when converting between numeric data types and boolean values than it is to use a single 8-bit field. This means while you wouldnt decrease internal efficiency of a boolean data type stored as 8-bits conversions between other data types would suffer.

Search for the phrase "twos complement" to learn more.
 
Back
Top