[Insight-developers] warnings in vnl_math

Arnaud GELAS arnaud_gelas at hms.harvard.edu
Thu Mar 11 14:14:40 EST 2010


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


More information about the Insight-developers mailing list