Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

4 years after, I still don't understand!

Name: Anonymous 2011-09-03 14:22

Why does everyone hate Java so much?

To me it seems like it's got it's strengths and weakness like any other language.

I'm aware of it's weakness but I don't think that the amount of hatred upon the whole language is justified.

Name: Anonymous 2011-09-04 6:16

>>34
Wow you're stupid. You just don't get it. There's more to unsigned integers than just "reading" them as you put it. Just because they're two's complement notation doesn't mean that you can use signed comparisons on numbers where you expect unsigned semantics.


// C version, assuming int is a 32-bit integer on target platform
unsigned int a = 0xFFFFFFFF;
unsigned int b = 0x00000005;
if (b < a) {
    printf("fuck you >>34\n");
}

// Java version
int a = 0xFFFFFFFF;
int b = 5;
if (b < a) {
    System.out.println("fuck you >>34\n");
}


The C version will print the message, whereas the Java version will not. There are different semantics involved. In C compilers and the JVM, with signed integers, signed comparison machine instructions are emitted. For unsigned types in C, unsigned comparison instructions are used. There is a difference which affects order. In Java, the only way to get the same semantics is to use a larger signed integer type which can represent all of the unsigned values possible with the smaller unsigned type.

You're also stuck in OO-thought processes focused on tiny toy one-man projects. In large scale projects, if you have to support lots of unsigned integers has a big impact.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List