-Wconversion is broken for 'short' parameters.

Philipp Thomas pthomas@suse.de
Thu Jul 27 03:08:00 GMT 2000


* Veksler Michael (mveksler@techunix.technion.ac.il) [20000727 08:30]:

>  void foo(short);
>  int main()
>  {
>    short s=1;
>    foo(s);
>    return 0;
>  }
> 
> This gives the following (obviously wrong) warning:
>    warning: passing arg 1 of `foo' with different width due to prototype

No, it's correct. Let me quote from the documentation

`-Wconversion'
     Warn if a prototype causes a type conversion that is different from
     what would happen to the same argument in the absence of a prototype. 

If there had been no prototype or a K&R one, s would have been promoted to
int in the call to foo. -Wconversion is only good for porting K&R code to
ISO C, because it warns you of possible pitfalls.

Philipp

-- 
Philipp Thomas <pthomas@suse.de>
Development, SuSE GmbH, Schanzaecker Str. 10, D-90443 Nuremberg, Germany

#define NINODE  50              /* number of in core inodes */
#define NPROC   30              /* max number of processes */
 	-- Version 7 UNIX for PDP 11, /usr/include/sys/param.h


More information about the Gcc-bugs mailing list