Why has Java not got unsigned data types? I've done two "Java Applications" programming projects so far - Data Packetisation, and Image Processing.
Both have required me to use the variable & 0xff trick to get them to output the correct numbers and values.
Surely unsigned data types are used enough in the computing world that the people at sun saw this as a potential problem. Off the top of my head I can think of the following:
- Data packetisation and image processing (both stored as bytes)
- Any form of text processing
I'm almost certain there are an uncountable number of instances where you need unsigned data types.
When Sun made HotJava, did they not think "ah, these images are unsigned byte values, why didn't we think of that?"
Such a silly omission means that I'm now doing 0xff operations all over the shop in my code. It means that:
a) My code is slower (not a biggie given current processing speeds, but one method of my image processing takes a few seconds to complete, so faster = better)
b) My code is more bloated as I'm in effect casting to an integer and then casting back to a byte again to display the image using java's default libraries... (see above bracketed comment)
c) My code is more difficult to find bugs is (trust me, I coded the damn thing
d) My code is more prone to error (what's the difference between oxff and 0xff?
If java is based on C, why did they take this functionality out????
It beggars belief (to me at least
</rant
-Mole
