Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Chris
  • *Experts*
Posted

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.

Posted

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....

Chris
  • *Gurus*
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...