[Insight-developers] STYLE: Un-necessary use of static_cast -- should we care?

Johnson, Hans J hans-johnson at uiowa.edu
Mon Jul 23 17:16:00 EDT 2012


I agree with Sean here.

I like the idea of using a debug-only assertion if the pointer is NULL.  I
don't think that this should be a performance problem, and It is my belief
(no proof) that the compiler will minimize the work needed when it can
deterministically identify what the real pointer types are.

Hans

--
Hans J. Johnson, Ph.D.
hans-johnson at uiowa.edu
Assistant Professor of Psychiatry
University of Iowa Carver College of Medicine
W278 GH, 200 Hawkins Drive

Iowa City, Iowa 52242
Phone:  319-353-8587







-----Original Message-----
From: Sean McBride <sean at rogue-research.com>
Organization: Rogue Research Inc.
Date: Monday, July 23, 2012 4:11 PM
To: Kent Williams <norman-k-williams at uiowa.edu>, ITK
<insight-developers at itk.org>
Subject: Re: [Insight-developers] STYLE: Un-necessary use of static_cast
-- should we care?

On Mon, 23 Jul 2012 20:42:25 +0000, Williams, Norman K said:

>So the question is this: do we keep static_cast where they aren't needed?

My 2¢: I think that kind of unnecessary cast is a code smell, and would
remove it.

>and should we add dynamic_cast in the frequent case where an input or
>output of a filter is assumed to be of a particular type?

Perhaps in a debug-only assert()?

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


_______________________________________________
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.php

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



________________________________
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