[Insight-developers] warnings in vnl_math

Arnaud GELAS arnaud_gelas at hms.harvard.edu
Thu Mar 11 15:06:30 EST 2010


By adding -Wconversion lots of warnings appear from vnl, vxl, gdcm, and 
itk classes...

I can set up a nightly build with -Wconversion, and start tracking some 
of these issues (at least the one in itk), but what about the one coming 
from external libraries?

Arnaud


On 03/11/2010 02:14 PM, Arnaud GELAS wrote:
> Hi Luis,
>
> I have just compiled some stuff and I get some conversion warnings in
> vnl_math.h (really easy to fix).
> I can fix it in itk, but I guess it should also be fixed in vnl/vxl, right?
>
> How can I let vxl/vnl people know about it?
>
>
> inline unsigned char  vnl_math_abs(signed char x)   { return x<  0 ?
> static_cast<unsigned char>(-x) : x; }
> inline unsigned char  vnl_math_abs(char x)          { return
> static_cast<unsigned char>(x); }
> inline unsigned short vnl_math_abs(short x)         { return x<  0 ?
> static_cast<unsigned short>(-x) : x; }
> inline unsigned short vnl_math_abs(unsigned short x){ return x; }
> inline unsigned int   vnl_math_abs(int x)           { return x<  0 ? -x
> : x; }
> inline unsigned long  vnl_math_abs(long x)          { return x<  0L ? -x
> : x; }
>
> it has to be changed to
>
> inline unsigned char  vnl_math_abs(signed char x)   { return x<  0 ?
> static_cast<unsigned char>(-x) : static_cast<unsigned char>(x); }
> inline unsigned char  vnl_math_abs(char x)          { return
> static_cast<unsigned char>(x); }
> inline unsigned short vnl_math_abs(short x)         { return x<  0 ?
> static_cast<unsigned short>(-x) : static_cast<unsigned short>(x); }
> inline unsigned int   vnl_math_abs(int x)           { return x<  0 ?
> static_cast<unsigned int>(-x) : static_cast<unsigned int>(x); }
> inline unsigned long  vnl_math_abs(long x)          { return x<  0L ?
> static_cast<unsigned long>(-x) : static_cast<unsigned long>(x); }
>
>
>
> Arnaud
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>    



More information about the Insight-developers mailing list