This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: c/3246: gcc -Wconversion doesn't work properly


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]