Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> the left operand, which starts out as unsigned char, will get promoted to int

This is a big flaw in C. Quietly promoting an unsigned type to a signed type, simply because it was added to by a signed number? And that signed number is deterministically known to be > 0? C has major problems like this, you don't even need to look to UB to run into them. I think mixing signed and unsigned values should always give you a stern warning, explaining the pitfalls, and yet (a) the warning you get is some useless Chernobyl error light like "mixing signed and unsigned values" and (b) that warning is probably not enabled easily, without bringing in lots of stupid warnings too.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: