Hacker News new | ask | show | jobs
by cstavish 4215 days 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?

1 comments

If you use an unsigned 32 bit integer instead of a signed one then you run into problems at 4 instead 2 gigabytes.
But who would have JSON files bigger than 4GB? ;)
We 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.

The 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.
4194304 K ought to be enough for anybody.
Not many people. But in another 12 years?
While 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.