Re: -Wconversion considers unsigned short int unequal to itself?

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

 



On Mon, 22 Feb 2010, Davies, Aaron wrote:

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

gcc-4.3 and later don't give this warning anymore.

--
Marc Glisse

[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