[Insight-developers] itkSetClampMacro -- warnings for unsigned int values?

Williams, Norman K norman-k-williams at uiowa.edu
Mon Jul 18 11:43:59 EDT 2011


This throws compiler warnings:

  itkSetClampMacro(MaxLevel, unsigned int, 0, NumericTraits<unsigned
int>::max() );

Specifically, it uses the expression _arg < 0, which is always false.


This is only seen in the '-Wall -Wextra' world.

Possible solution -- change itkMacro.h and replace

_arg < min

with

!(_arg >= min)

This is a niggling point but eliminating specious and spurious warnings
will make it easier to see the real warnings.

I imagine that once a compiler optimizes the code in that macro, the end
result will be nearly the same.
--
Kent Williams norman-k-williams at uiowa.edu






________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________


More information about the Insight-developers mailing list