[Insight-developers] ITK Dashboard : unused variable : 12 warnings

Luis Ibanez luis.ibanez at kitware.com
Mon Mar 16 07:23:51 EDT 2009


Hi Sean,

The build from

           RogeResearch5,
           Mac10.5-InsightBS-rel

Is reporting 12 warnings, all coming from


     Insight/Utilities/vxl/core/vnl
                          vnl_diag_matrix.h

Line 81:


81: inline T& operator () (unsigned i, unsigned j) {
82:    assert(i == j);
83:    return diagonal_[i];
84:   }


It would seem that in release mode, the "assert()"
expression is not passed to the compiler.

This is because the "assert()" macro is defined
as empty when the flag "NDEBUG" is ON.

The warning is innocuous in this case, so it
seems reasonable to modify the code in order to
silence the warning.

One suggestion for silencing this warning is to
replace line 81 with the following insert:


81: #ifdef NDEBUG
82: inline T& operator () (unsigned i, unsigned   ) {
83: #else
84: inline T& operator () (unsigned i, unsigned j ) {
85: #endif


Do you see any drawback in making this replacement ?


Given the small size of the method, another approach
could be to put the two full versions of the method
inside the #ifdef/#else/#endif block.


Any suggestions ?



     Thanks



        Luis




More information about the Insight-developers mailing list