Link Details

Link 52863 thumbnail
User 111696 avatar

By bloid
via in.relation.to
Published: Nov 16 2007 / 11:36

While there are many things I like about the Java language, the lack of unsigned types has always bothered me. According to Gosling, they were too complicated: 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. Ironically this kind of hand-holding tends to introduce other complexities that are often more difficult to deal with than the original solution. In this particular case, leaving out unsigned types doesn't stop the need to work with unsigned data. Instead, it forces the developer to work around the language limitation in various unusual ways.
  • 16
  • 1
  • 1438
  • 354

Comments

Add your comment
User 107114 avatar

daniel replied ago:

0 votes Vote down Vote up Reply

I disagree, but a thought-provoking article.

User 184684 avatar

kdavies replied ago:

0 votes Vote down Vote up Reply

I agree with the article, there has been many times I wish there were unsigned types, and have had to do weird work arounds.

User 111696 avatar

bloid replied ago:

0 votes Vote down Vote up Reply

yeah, reading legacy file formats from the spec document makes you shudder when you read "uint" ;-)

User 210175 avatar

jtheory replied ago:

0 votes Vote down Vote up Reply

I doubt the proposed solution is feasible, but I agree that working with unsigned bytes in Java is a headache. I ran into it writing a Java classfile reader, of all things... it's painful working with Java's own bytecode in Java, because... yeah, those bytes.

Does anyone know of good OSS libraries to facilitate working with unsigned bytes? I have looked terribly hard, but I haven't run across anything in Apache commons, etc..

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.