[Insight-developers] RE: itkImageMomentCalculatorTest

Lorensen, William E (CRD) lorensen@crd.ge.com
Thu, 28 Feb 2002 11:13:01 -0500


Yes you are correct. Now, if our warnings were down to zero, some compilers warn about this...
For example the gcc gives this warning:

c++  -Wall -ftemplate-depth-64 -ftemplate-depth-50 itkImageMapperTest.o
-L/projects/quality/itkQuality/Insight-solaris/Utilities/zlib
-L/projects/quality/itkQuality/Insight-solaris/Utilities/png
-L/projects/quality/itkQuality/Insight-solaris/Code/Common
-L/projects/quality/itkQuality/Insight-solaris/Code/IO
-L/projects/quality/itkQuality/Insight-solaris/Code/Numerics/vxl
-L/projects/quality/itkQuality/Insight-solaris/Code/BasicFilters -lpthread -lthread -ldl
-lVXLNumerics -lm -lITKIO -lITKBasicFilters -lITKCommon -lVXLNumerics -lpthread -lthread -ldl
-lVXLNumerics -lm -lITKIO -lITKBasicFilters -lITKCommon -lVXLNumerics
-Wl,-R,/projects/quality/itkQuality/Insight-solaris/Utilities/zlib:/projects/quality/itkQuality/Insig
ht-solaris/Utilities/png:/projects/quality/itkQuality/Insight-solaris/Code/Common:/projects/quality/i
tkQuality/Insight-solaris/Code/IO:/projects/quality/itkQuality/Insight-solaris/Code/Numerics/vxl:/pro
jects/quality/itkQuality/Insight-solaris/Code/BasicFilters  -o itkImageMapperTest
/projects/quality/itkQuality/Insight/Testing/Code/Algorithms/itkImageMomentsTest.cxx: In function
`int main(int, char **)':
/projects/quality/itkQuality/Insight/Testing/Code/Algorithms/itkImageMomentsTest.cxx:68: warning:
left-hand operand of comma expression has no effect
/projects/quality/itkQuality/Insight/Testing/Code/Algorithms/itkImageMomentsTest.cxx:71: warning:
left-hand operand of comma expression has no effect

There are others. I've been trying to drive down warnings on and off for months. Perhaps the team
should get serious about warnings. In vtk, we don't allow any!

Bill



-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez@kitware.com]
Sent: Thursday, February 28, 2002 11:00 AM
To: Lorensen, William E (CRD)
Cc: insight-developers@public.kitware.com
Subject: itkImageMomentCalculatorTest



Hi

The error in itkImageMomentCalculatorTest resulted
to be a trace of the removal of the comma list initialization
syntax for vectors.

Theoretical values for the moments were entered like

    momentVector = 1.5,       2.5,       1.25;    

the momentVector variable end up with values:

           1.5,   1.5,   1.5     !!!

because one of the initializers performs a Fill() operation
and instructions after the "," are considered to be a separate
statements and...  

         1.5;

is a valid statement !!  

It does nothing, but the compiler seems to be happy with it.

something like:

   int a;
   a;
   a;

Also passes smoothly through compilation.

=====

So, any traces of the comma list initializer like

    vv = 1.3,    2.4,    5.6;    

will be read by the compiler as:

    vv.Fill( 1.3 );
     2.4;
     5.6;

and notations like


    vv = x,  y,  z;

will be interpreted as:

    vv.Fill( x );
    y;
    z;


===


    Luis