Wrong warning for different signedness

Started by frankie, July 24, 2018, 12:04:10 PM

Previous topic - Next topic

frankie

Consider the following snippet:

unsigned short a = 1;
unsigned long  b = 2;

if (a <= b)
printf("a <= b\n");

Will give the warning:

C:\PELLESC\Bugs\Warning_bug.c(10): warning #2251: Operands of '<=' have types with different signedness: 'int' and 'unsigned long int'.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Pelle

As designed. I'm not going to waste time on a corner case like this.
/Pelle

frankie

Quote from: Pelle on July 24, 2018, 03:59:22 PM
As designed.
I understand that this is not a major issue in this phase.
But I can't understand why is by design  :(.
Both values are unsigned, why the signedness mismatch complain?  :(
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide