How to turn this warning off?

Sergei Organov osv@javad.com
Thu May 31 14:19:00 GMT 2007


Tom St Denis <tstdenis@ellipticsemi.com> writes:
> Sergei Organov wrote:
>> Hello,
>>
>> I can't find a command-line switch to turn off the following warning:
>>
>> $ gcc -c warn.cc
>> warn.cc: In function 'void g(float)':
>> warn.cc:2: warning: passing 'float' for argument 1 to 'void f(int)'
>>   
>
> Have you considered not passing a float?  Or performing a cast?

Yes I had. I do want implicit conversion in some of those cases.

I'd be happy to add a cast, but there is no way in C/C++ to say: "cast it
to the actual type of the function argument".

I've now checked GCC sources, and it seems that this warning is
unconditional in 4.1.1, whereas it has been fixed and put under
-Wconversion in 4.2.0.

> Also you're compiling a .cc file which GCC assumes is C++ not C.

Yeah, I mostly use C++.

-- Sergei.



More information about the Gcc-help mailing list