romeric / fastapprox

Approximate and vectorized versions of common mathematical functions
193 stars 35 forks source link

narrowing conversion warning #1

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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 armstron...@gmail.com on 30 Jan 2012 at 10:06

GoogleCodeExporter commented 8 years ago
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 paul.min...@gmail.com on 31 Jan 2012 at 2:59

GoogleCodeExporter commented 8 years ago
Please notice that with clang these warnings become errors.

Original comment by ilio.cat...@gmail.com on 7 Apr 2013 at 8:49

GoogleCodeExporter commented 8 years ago
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 paul.min...@gmail.com on 7 Apr 2013 at 11:33

GoogleCodeExporter commented 8 years ago
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 lzhang...@gmail.com on 15 Jul 2014 at 5:14