NO

Author Topic: Wrong warning for different signedness  (Read 405 times)

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1686
Wrong warning for different signedness
« on: July 24, 2018, 12:04:10 pm »
Consider the following snippet:
Code: [Select]
unsigned short a = 1;
unsigned long  b = 2;

if (a <= b)
printf("a <= b\n");
Will give the warning:
Code: [Select]
C:\PELLESC\Bugs\Warning_bug.c(10): warning #2251: Operands of '<=' have types with different signedness: 'int' and 'unsigned long int'.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 1968
    • http://www.smorgasbordet.com
Re: Wrong warning for different signedness
« Reply #1 on: July 24, 2018, 03:59:22 pm »
As designed. I'm not going to waste time on a corner case like this.
/Pelle

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1686
Re: Wrong warning for different signedness
« Reply #2 on: July 25, 2018, 11:41:10 am »
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?  :(