wildfire1982 Posted October 30, 2003 Posted October 30, 2003 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. Quote Chris
*Experts* Volte Posted October 30, 2003 *Experts* Posted October 30, 2003 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. Quote
wildfire1982 Posted October 31, 2003 Author Posted October 31, 2003 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.... Quote Chris
*Gurus* Derek Stone Posted October 31, 2003 *Gurus* Posted October 31, 2003 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. Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.