• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java SE 8 for the Really Impatient Question

 
Michael Quirk
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Cay,

Do you have any personal opinion with the addition of unsigned ints? I think Sun had left them out to keep the language simpler. Do you think the need for them has trumped the need for simplicity?

Thanks.
 
Cay Horstmann
author
Ranch Hand
Posts: 172
15
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
unsigned int isn't there as a datatype. There are only a few library calls to enable working with them. You store them in regular ints. Then you have to know the rules of two's complement arithmetic. Adding and subtracting works out of the box. But to compare two 32-bit unsigned quantities that are stored in int variables, you can't use <. Instead, use Integer.compareUnsigned.

It's inconvenient enough that only those people who really need them will use them.

Cheers,

Cay
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!