[Insight-developers] VS6 warnings in Review are probably errors

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Sat Feb 21 16:52:45 EST 2009


Hi Bill,


Le 21 févr. 09 à 01:53, Bill Lorensen a écrit :

> I retract my last comment:
> 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 );
>
> I see now, that the algorithm is not used for types (like int) that
> have large max() values. I think my other comments about overflow
> still hold.
>

Yes, they do. Thanks for the report - I'm fixing that.

Would it be possible to make kwstyle produce an error for the non  
standard method names?

Gaëtan



> Bill
>
> On Fri, Feb 20, 2009 at 7:49 PM, Bill Lorensen <bill.lorensen at gmail.com 
> > wrote:
>> 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
>>

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.mandriva.org
http://www.itk.org  http://www.clavier-dvorak.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090221/b322baac/attachment.pgp>


More information about the Insight-developers mailing list