-Wconversion considers unsigned short int unequal to itself?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I discoved the following behavior while trying to get warnings-clean on some existing code. It was intially found in a call to ntohs(3); the below snippet isolates it. Is this warning expected?

$ gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat test.c
int f(unsigned short int i){return i;}
int main(int c,char**v){return f((unsigned short int)0);}
$ gcc -Wall -Wconversion test.c
test.c: In function 'main':
test.c:2: warning: passing argument 1 of 'f' with different width due to prototype
--------------------------------------------------------------------------
NOTICE: If received in error, please destroy, and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. We may monitor and store emails to the extent permitted by applicable law.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux