fastapprox icon indicating copy to clipboard operation
fastapprox copied to clipboard

narrowing conversion warning

Open GoogleCodeExporter opened this issue 9 years ago • 4 comments

is there a PRAGMA one can use to prevent these 'narrowing conversion' warnings?

Thanks,
Whit

this is gcc 4.6 on debian testing:

../cppbugs/fastexp.h:71:76: error: narrowing conversion of ‘((clipp + 
1.2694269561767578125e+2f) * 8.388608e+6f)’ from ‘float’ to ‘uint32_t 
{aka unsigned int}’ inside { } [-fpermissive]

Original issue reported on code.google.com by [email protected] on 30 Jan 2012 at 10:06

GoogleCodeExporter avatar Apr 18 '16 14:04 GoogleCodeExporter

Yeah, that seems annoying.

This suggests static_cast is the fix.  
http://stackoverflow.com/questions/4434140/narrowing-conversions-in-c0x-is-it-ju
st-me-or-does-this-sound-like-a-breakin

Original comment by [email protected] on 31 Jan 2012 at 2:59

  • Changed state: Accepted

GoogleCodeExporter avatar Apr 18 '16 14:04 GoogleCodeExporter

Please notice that with clang these warnings become errors.

Original comment by [email protected] on 7 Apr 2013 at 8:49

GoogleCodeExporter avatar Apr 18 '16 14:04 GoogleCodeExporter

I thought this was fixed (I added cast.h and sprinkled the code appropriately 
with casting operators).  I'm using gcc 4.6.3 and not seeing this.  Do you have 
the latest version of the software?

Original comment by [email protected] on 7 Apr 2013 at 11:33

GoogleCodeExporter avatar Apr 18 '16 14:04 GoogleCodeExporter

I think this isn't fixed completely. I'm testing using the latest release. On a 
Mac OS 10.9, ./configure && make check fails because clang treat those warnings 
as errors.

Original comment by [email protected] on 15 Jul 2014 at 5:14

GoogleCodeExporter avatar Apr 18 '16 14:04 GoogleCodeExporter