Stevens Miller wrote:As ever, Winston is correct.
which means that this glaring omission in the language
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
fred rosenberger wrote:i am not an expert on this, but I believe I have heard that java is not great for real-time applications. If it is absolutely critical you know how long your code will take to run (i think one such example is missile guidance systems), you don't want the JVM to pause for a few milliseconds while it does a GC.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Stevens Miller wrote:So, we now have, in the library the Byte.toUnsignedInt method, which "supports" treating bytes as unsigned values.
Perseverance is best when informed.
Winston Gutkowski wrote:Why on earth should I care whether some sub-atomic particle in the language is signed or not, when it makes absolutely no difference to the way it behaves except in terms of an arithmetic result
which, as you've already proved, can easily be converted to an unsigned value
...and the only reason it does that is due to other sub-atomic behaviour (usually widening conversion) that I really shouldn't have to worry about.
And the fact of the matter is that you DO have an unsigned numeric value: char. So, if it was so important, why aren't they splattered all over the Java realm in areas they were never really designed for?
"Il y a peu de choses qui me soient impossibles..."
L Foster wrote:I work with Image Processing code, where I have to do conversions on things like Tiff and MPG files, on occasion. I also have to shoot buffers back-and-forth to OpenGL. Having to deal with regular bytes, which are signed in Java, means I have to do little tricks like adding 256 to any value less than 0. -1 is really 255. -2 is really 254. These negatives occur simply from reading in values greater than 127. If you can just get stuff and push it as you found it, it may not be a problem, but if you have to treat it as an integer, or combine three bytes together as parts of an int, it can be problematic.
"Il y a peu de choses qui me soient impossibles..."
Stevens Miller wrote:Now things work again, so why am I still grousing? Here's why: that inner loop had 14 bytecode instructions in it to begin with.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
L Foster wrote:I work with Image Processing code, where I have to do conversions on things like Tiff and MPG files, on occasion.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:And that darn JVM, that presumably takes milliseconds to load and intialise, not to mention the classes required to make your program work, don't enter into that
(probably peco-second based) equation?
So, what you're telling me is that a single use: the modular result of an arithmetic function - and moreover, it's use as an index - for which unsigned ints can't possibly have been intended, is sufficient reason to double the number of primitives in Java ... things which were arguably a mistake to begin with?
Clearly Microsoft think the way you do, since C# supports them; but given their track-record on writing software - let alone operating systems - you'll forgive me if I don't bow down three times to their decision.
The fact is that, for every major integral transformation other than division, signed 2's complement numbers behave exactly like unsigned ones. It's one of the reasons we love 2's complement. So the business of being a 'result' only comes to light when we look at it.
And how many times do we tell beginners on this site that what an object contains is NOT the same thing as what it looks like to us puny humans.
But you're going to have to come up with something better than 14% to convince me that we're right.
"Il y a peu de choses qui me soient impossibles..."
Stevens Miller wrote:Now you're being hyperbolic. Even modern desktop computers don't do anything in a picosecond.
Further, I believe your criticism inverts the issue: I am not saying this very common, very useful, very obvious way to deal with image data justifies adding more primitive types to Java. Rather, I am saying that, in light of this very common, very useful, very obvious way to deal with image data, no one has ever been able to provide a convincing justification for leaving them out.
That speaks to a level of abstraction that's not available to us here.
we both find it annoying, distracting, inefficient, and error-prone to have to keep putting things like "b & 0xFF" and "b < 0 ? b + 256 : b" everywhere, when unsigned bytes would (and, in other languages, effortlessly and harmlessly do) let us just say "b." Since the addition of unsigned native integer types would have no effect whatsoever upon anyone who doesn't need them, I'm baffled as to why anyone opposes them.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Perseverance is best when informed.
L Foster wrote:@Winston, good call moving this to another thread.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
L Foster wrote:Since this topic is now "for or against", I will state flatly that if the unsigned primitives could be added without too great a penalty to other aspects of the language ... I would advocate adding them.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
"Il y a peu de choses qui me soient impossibles..."
Winston Gutkowski wrote:Has anybody ever used shorts?
"Il y a peu de choses qui me soient impossibles..."
Stevens Miller wrote:It will be delivering a stream of unsigned shorts.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Stevens Miller wrote:Well, I think we've all had our say(s) on this, so I'll conclude my contribution by saying I still have not heard a reason why leaving unsigned ints out of Java served any useful purpose, and I will eagerly await the PM from Winston with the link to the place selling 10GHz desktop computers.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:I assumed that since my 2 year old laptop, which was by no means expensive, was an i7 2.4, that they would have certainly cracked 5 by now; but it seems they're going for ever more cores rather than clock speed, and even the top ones are still only around 4...
"Il y a peu de choses qui me soient impossibles..."
Winston Gutkowski wrote:
Stevens Miller wrote:It will be delivering a stream of unsigned shorts.
Ah, but an unsigned short does exist. It's called a char.![]()
"Il y a peu de choses qui me soient impossibles..."
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
|