[Insight-users] NumericTraits level 3 warnings on VS 2008

Denis Shamonin dshamoni at science.uva.nl
Wed Nov 26 06:23:48 EST 2008


Dear All,

I've compile warnings on VS 2008 (Itk 3.10.0) for

Class:
NumericTraits<char> : public vcl_numeric_limits<char>

Function:
  static char min() { return char(255) < 0 ? -128 : 0; }
  static char max() { return char(255) < 0 ? 127 : 255; }

Warnings:
itk3\include\common\itkNumericTraits.h(165) : warning C4310: cast
truncates constant value
itk3\include\common\itkNumericTraits.h(166) : warning C4310: cast
truncates constant value

Should it be changed to
  static char min() { const char minValue=255; return char(minValue) < 0 ?
-128 : 0; }
  static char max() { const char maxValue=255; return char(maxValue) < 0 ?
127 : 255; }


Thanks,
-Denis Shamonin



More information about the Insight-users mailing list