Jump to content
  • Advertisement
Sign in to follow this  
SteveDeFacto

char vs BYTE array to represent raw buffer data

This topic is 2851 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Quote:
Original post by SiCrane
Depends, what language and platform are you asking about?


Sorry I forgot to say that. I'm talking about C++ and windows

Share this post


Link to post
Share on other sites
If you open WinDef.h, you will notice that BYTE is typedef'ed to unsigned char and thus the only difference is the signedness.

Share this post


Link to post
Share on other sites
It might help readability (though, it would be better to give the variable itself a good name). The computer won't care whether it's written 'char' or 'BYTE' in your code.

Share this post


Link to post
Share on other sites
byte makes more sense for readability. Unless your raw data is a sequence of actual characters, using the char type would be misleading.

Share this post


Link to post
Share on other sites
I'm a fan of uint8_t myself. Makes the bit width of your buffer elements explicit, which is really the most important thing to know about them.

Share this post


Link to post
Share on other sites
Quote:
Original post by coder0xff
byte makes more sense for readability. Unless your raw data is a sequence of actual characters, using the char type would be misleading.

What he said

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!