Interview with Dennis Ritchie, Bjarne Stroustrup, and James Gosling (2000)
1–7 of 7 posts
Re: Interview with Dennis Ritchie, Bjarne Stroustrup, and James Gosling (2000)
#2> Quiz any C developer about unsigned, and pretty soon you discover that almost no C developers actually understand what goes on with unsigned, what unsigned arithmetic is. Things like that made C complex. The language part of Java is, I think, pretty simple. The libraries you have to look up.
Re: Interview with Dennis Ritchie, Bjarne Stroustrup, and James Gosling (2000)
#3This is the famous interview where Gosling tells why he didn't add unsigned types to Java, > Quiz any C developer about unsigned, and pretty soon you discover that almost no C developers actually understand what goes on with unsigned, what unsigned arithmetic is. Things like that made C complex. The language part of Java is, I think, pretty simple. The libraries you have to look up.
Re: Interview with Dennis Ritchie, Bjarne Stroustrup, and James Gosling (2000)
#4This is the famous interview where Gosling tells why he didn't add unsigned types to Java, > Quiz any C developer about unsigned, and pretty soon you discover that almost no C developers actually understand what goes on with unsigned, what unsigned arithmetic is. Things like that made C complex. The language part of Java is, I think, pretty simple. The libraries you have to look up.
What does he actually mean by this? I've dabbled in C's specification and weird behaviour on multiple occasions but I have no clue what he is referring to.
Re: Interview with Dennis Ritchie, Bjarne Stroustrup, and James Gosling (2000)
#5Earlier quoted context omitted.
What does he actually mean by this? I've dabbled in C's specification and weird behaviour on multiple occasions but I have no clue what he is referring to.
It has to do with the underflow and overflow rules, they are different between signed and unsigned integers, in regards to optimization freedom by the compilers.
Re: Interview with Dennis Ritchie, Bjarne Stroustrup, and James Gosling (2000)
#6Earlier quoted context omitted.
It has to do with the underflow and overflow rules, they are different between signed and unsigned integers, in regards to optimization freedom by the compilers.
Also, the promotion rules for mixing signed and unsigned numbers are pretty complex. It's very easy to make mistakes, sometimes with catastrophic results (e.g. negative numbers turning into huge positive number)
Re: Interview with Dennis Ritchie, Bjarne Stroustrup, and James Gosling (2000)
#7Earlier quoted context omitted.
Also, the promotion rules for mixing signed and unsigned numbers are pretty complex. It's very easy to make mistakes, sometimes with catastrophic results (e.g. negative numbers turning into huge positive number)
Yea so overflow/underflow are a problem with signed integers, not unsigned ones. Promotion rules might be the only candidate for hidden complexity here I guess
Second, signed integer overflow is always undefined behavior whereas unsigned integer overflow is ok (= modulo behavior).
The actual issue I was describing is about accidentally converting a negative (signed) integer to an unsigned integer, which completely changes its value. This is not a problem with signed or unsigned integers per se, but rather with the implicit conversions between these types. IMO this should have never been allowed in the first place.