Skip to main content
GameDev.net gamedev.net
🔒 Locked

char vs BYTE array to represent raw buffer data

Started by JackOfAllTrades Oct 1, 2010 at 8:56 PM 6 replies 1.6k views
SiCrane
SiCrane
Depends, what language and platform are you asking about?
pablo24
pablo24
If you open WinDef.h, you will notice that BYTE is typedef'ed to unsigned char and thus the only difference is the signedness.
Nypyren
Nypyren
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.
coder0xff
coder0xff
byte makes more sense for readability. Unless your raw data is a sequence of actual characters, using the char type would be misleading.
Two things are infinite: the universe and human stupidity; and Im not sure about the universe. -- Albert Einstein
Shinkage
Shinkage
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.
TTK-Bandit
TTK-Bandit
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.