[Insight-developers] VS6 warnings in Review are probably errors
Bill Lorensen
bill.lorensen at gmail.com
Fri Feb 20 19:49:32 EST 2009
Gaetan,
My VS6 build gives the following warnings:
C:\Projects\Insight\Code\Review\itkMovingHistogramImageFilter.txx(49)
: warning C4756: overflow in constant arithmetic
C:\Projects\Insight\Code\Review\itkMovingHistogramImageFilter.txx(49)
: warning C4756: overflow in constant arithmetic
C:\Projects\Insight\Code\Review\itkMovingHistogramMorphologyImageFilter.h(34)
: warning C4756: overflow in constant arithmetic
C:\Projects\Insight\Code\Review\itkMovingHistogramMorphologyImageFilter.h(40)
: warning C4756: overflow in constant arithmetic
C:\Projects\Insight\Code\Review\itkMovingHistogramMorphologyImageFilter.h(34)
: warning C4756: overflow in constant arithmetic
C:\Projects\Insight\Code\Review\itkMovingHistogramMorphologyImageFilter.h(40)
: warning C4756: overflow in constant arithmetic
C:\Projects\Insight\Code\Review\itkAnchorHistogram.h(135) : warning
C4756: overflow in constant arithmetic
C:\Projects\Insight\Code\Review\itkAnchorHistogram.h(135) : warning
C4756: overflow in constant arithmetic
For example, in itkAcnchorHistogram.h:
m_Size = static_cast<unsigned int>( NumericTraits< TInputPixel >::max() -
NumericTraits< TInputPixel
>::NonpositiveMin() + 1 );
will overflow for types that have NonpositiveMin() = 0 since max() + 1
overflows.
Also, these some of these classes have non-standard method names that
start with lower case letters (e.g.
MovingHistogramMorphologyImageFilter has a method named
useVectorBasedAlgorithm. This should be UseVectorBasedAlgorithm. Also
initVector which should be InitializeVector.
Also, the initVector method creates a vector of a very large size:
m_Vector.resize( static_cast<int>( NumericTraits< TInputPixel
>::max() - NumericTraits< TInputPixel >::NonpositiveMin() + 1 ), 0 );
Bill
More information about the Insight-developers
mailing list