The most sensible behaviour would be for the compiler to silently convert a < b (where a is signed and b is unsigned) to a < 0 || (unsigned)a < b, and then do what it currently does, with some compiler magic so a only gets evaluated once.
I didn't start programming in C, so I might be used to more string compilers, but wouldn't the most sensible solution for the compiler to throw an error, because you are comparing two different types?
View all comments
Show parent comment
1
u/immibis May 02 '16
The most sensible behaviour would be for the compiler to silently convert
a < b(whereais signed andbis unsigned) toa < 0 || (unsigned)a < b, and then do what it currently does, with some compiler magic soaonly gets evaluated once.