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

David Cole david.cole at kitware.com
Mon Jul 18 12:03:31 EDT 2011


On Mon, Jul 18, 2011 at 11:43 AM, Williams, Norman K
<norman-k-williams at uiowa.edu> wrote:
> 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)
>

Won't this just change the warning to "this condition is always true" ..... ?


> 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.
> ________________________________
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list