5 ms·
>> Java gave me a choice that I didn't need, and I made the wrong choice What if Java gave an arguably more useful choice--whether to use a signed or unsigned
by cstavish 12y ago
>> Java gave me a choice that I didn't need, and I made the wrong choice
What if Java gave an arguably more useful choice--whether to use a signed or unsigned integer?
- deleted 12y ago[deleted]
- danbruc 12y agoBut only because asm.js works hard to make JavaScript differentiate between integers and floating point numbers.
- deleted 12y ago[deleted]
- danbruc 12y agoThis is a decision a compiler can never make in a reliable way because it entirely depends on the actual input and is not known until runtime. You may get away with dynamic recompilation when you realize that the input is not what you assumed when you compiled the code but I really doubt that this is a smart and efficient way to go about it. And asm.js is no evidence for the no side - the information is in the original source code, it does matter and asm.js works around the JavaScript limitation and makes this information available to the JavaScript compiler.
- whyever 12y agoIf you use an unsigned 32 bit integer instead of a signed one then you run into problems at 4 instead 2 gigabytes.
- takeda 12y agoBut who would have JSON files bigger than 4GB? ;)
- onion2k 12y agoNot many people. But in another 12 years?
- guard-of-terra 12y agoWe do have a 18GB xml (daily). I guess it will turn to 10 GB json when we convert it over. Why is it even a question? Imagine a JSON of all the people on Earth.
- jmtulloss 12y agoThe parent is joking. "Why would you ever need X?" is a classic question that bites every software engineer at some point. Somebody always needs X.
- AgentConundrum 12y ago4194304 K ought to be enough for anybody.
- vbezhenar 12y agoWhile negative numbers very often provoke exceptions like IndexOutOfBoundException, with unsigned integers error could be uncaught for much longer time. I'm all for signed integers, unless storage requirements so tight that you really need that one bit.