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

It must be a compiler bug!

Name: Anonymous 2013-06-05 15:46

Why is it that every fucking moron who decides to start programming insists that any errors in their programs is the compiler's fault? Doesn't it ever enter their thick fucking skulls that if you don't even know the language, just maybe the error is their own?

Name: Anonymous 2013-06-07 5:31

>>5
More precisely, C happens to have three char types: char, signed char, unsigned char. And that's three types, count them. Unqualified char is either signed or unsigned (it's implementation defined), but is still a separate type from the correct qualified type. Then, right shift on a negative value of a signed integral type is again implementation-defined (but at least not undefined, praise balls).

So, basically, (char)0x80 >> 1 might be (char)0x40 or (char)0xC0, depending on whether your compiler treats char as signed and how does it do shifts on negative values.

An important note: left-shift on negative values is undefined.

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