[Insight-developers] VNL Warning: Is there an equivalent to itkNotUsed?

Sean McBride sean at rogue-research.com
Tue Aug 16 11:58:49 EDT 2011


On Tue, 16 Aug 2011 15:54:33 +0000, Johnson, Hans J said:

>I am trying to silence warnings from ITK for external tools.  I've
>noticed this warning that should be quite easy to silence, but I don't
>know the "vxl" compliant way to do it.
>
>Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_diag_matrix.h
>
>  //: get element with boundary checks.
>  inline T get (unsigned r, unsigned c) const {
>    assert(r == c); assert (r<size()); return diagonal_[r];
>  }
>
>/scratch/johnsonhj/src/Slicer/Applications/CLI/DiffusionApplications/
>ResampleDTI/ResampleDTI.cxx:1144:   instantiated from here
>/scratch/johnsonhj/src/Slicer-git-itkv4/ITKv4/Modules/ThirdParty/VNL/src/
>vxl/core/vnl/vnl_diag_matrix.h:106: warning: unused parameter ‘c’ [-
>Wunused-parameter]
>
>Any recommendations on how to silence this?

In my experience, the most portable way to silence that warning is to cast the expression to void, that is:

(void)c;

This works in C, C++, Objective-C, with gcc, icc, Visual Studio, clang, and CodeWarrior.

Some people do this:

c = c;

But please don't, because clang will warn about an operation that does nothing. :)

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada


More information about the Insight-developers mailing list