James Gosling’s explanation of why Java’s byte is signed

It appears that simplicity was the main reason. From this interview:

Gosling: For me as a language designer, which I don’t really count myself as these days, what “simple” really ended up meaning was could I expect J. Random Developer to hold the spec in his head. That definition says that, for instance, Java isn’t — and in fact a lot of these languages end up with a lot of corner cases, things that nobody really understands. Quiz any C developer about unsigned, and pretty soon you discover that almost no C developers actually understand what goes on with unsigned, what unsigned arithmetic is. Things like that made C complex. The language part of Java is, I think, pretty simple. The libraries you have to look up.

My initial assumption was that it’s because Java doesn’t have unsigned numeric types at all. Why should byte be an exception? char is a special case because it has to represent UTF-16 code units (thanks to Jon Skeet for the quote)

Leave a Comment