Unsigned char

  • Thread starter Thread starter hermbagger
  • Start date Start date
Hello..

Does anyone know the C# equivalent of an unsigned char in C++?

Thanks!

unsigned char? can a char be unsigned? isnt unsigning a contextual
thing?

suppose you have the char © - its code is A9, 169 to you and me as an
unsigned byte, or -87 as a signed byte. either way, -87 or 169.. its
still A9, or 10101001 as binary.. or © as a char who cares what the
sign is?
 
In .NET, it is the byte class, as it has the same storage capacity as a
char does in C++.

However, byte is not the inherent character type for .NET. That would
be char. However, you should be aware that a char instance is a 16-bit
value, and not an 8-bit one, like one might expect coming from C++.
 
cjard said:
unsigned char? can a char be unsigned? isnt unsigning a contextual
thing?

In C++ it can.
suppose you have the char © - its code is A9, 169 to you and me as an
unsigned byte, or -87 as a signed byte. either way, -87 or 169.. its
still A9, or 10101001 as binary.. or © as a char who cares what the
sign is?

If you do something that does sign extension you will see the difference.

Arne
 
Back
Top