From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Joseph S. Myers" To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org Subject: Re: c/3246: gcc -Wconversion doesn't work properly Date: Tue, 19 Jun 2001 05:16:00 -0000 Message-id: <20010619121603.999.qmail@sourceware.cygnus.com> X-SW-Source: 2001-06/msg00777.html List-Id: The following reply was made to PR c/3246; it has been noted by GNATS. From: "Joseph S. Myers" To: Cc: , Subject: Re: c/3246: gcc -Wconversion doesn't work properly Date: Tue, 19 Jun 2001 13:13:33 +0100 (BST) On 19 Jun 2001 ohhara@postech.edu wrote: > I use many warning options to find my small ( or big ) mistakes. > Therefore, I tried to use -Wconversion warning option. However, it > doesn't seem to work properly. -Wconversion isn't meant for finding mistakes in new code - only for an initial shake-down after converting ancient (predating the adoption of the first C standard in 1989) code to modern C with prototypes. The documentation could be clearer, and there could (and should) be a more useful version designed to warn about cases relevant to modern code (such as sign differences causing security holes) only, but that isn't what -Wconversion was designed to do. > Why does it prints warning message? Even if I changed "unsigned char" > to "unsigned short", the same warning message would be printed. Because with an old-style function definition and no prototype - the sort of program -Wconversion supposes you have just converted from - the argument would have been passed as an int. This may not be a useful warning, but the present -Wconversion isn't particularly. See the GCC projects list. -- Joseph S. Myers jsm28@cam.ac.uk