16-bit boolean???

wildfire1982

Regular
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.
 
That's 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 won't 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 wouldn't decrease internal efficiency of a boolean data type stored as 8-bits conversions between other data types would suffer.

Search for the phrase "two's complement" to learn more.
 
Back
Top