I was initially surprised that Java decides to specify that byte is signed, with a range from -128..127 (inclusive). I’m under the impression that most 8-bit number representations are unsigned, with a range of 0..255 instead (e.g. IPv4 in dot-decimal notation).
So has James Gosling ever been asked to explain why he decided that byte is signed? Has there been notable discussions/debates about this issue in the past between authoritative programming language designers and/or critics?
It appears that simplicity was the main reason. From this interview:
My initial assumption was that it’s because Java doesn’t have unsigned numeric types at all. Why should
bytebe an exception?charis a special case because it has to represent UTF-16 code units (thanks to Jon Skeet for the quote)