tbp <tbp...@gmail.com> writes: > I could really use -Wdouble-promotion but, atm, it appears quite impractical, > $ cat double.cc > #include <cstdio> > void foo(...); > int main() { > float f = 1; > foo(f); > printf("%f", f); > } > $ /usr/local/gcc-4.6-20100913/bin/g++ -Wdouble-promotion double.cc > double.cc: In function 'int main()': > double.cc:5:7: warning: implicit conversion from 'float' to 'double' > when passing argument to function [-Wdouble-promotion] > double.cc:6:16: warning: implicit conversion from 'float' to 'double' > when passing argument to function [-Wdouble-promotion] > > ... and the interesting bits are lost in the noise. I can't think of a > workaround. > So i have to ask: Is that how it's meant to be, or simply a temporary > shortcoming? Have i missed an obvious kludge?
This question is not appropriate for the mailing list g...@gcc.gnu.org. It would be appropriate for gcc-h...@gcc.gnu.org. Please take any followups to gcc-help. Thanks. This is among the kinds of things which -Wdouble-promotion is documented to warn about, so, yes, this is how it's meant to be. These are cases where a float value is implicitly converted to a double value. Note that the warning only applies to implicit conversions, so you can silence it by adding explicit casts to double. Ian