[Insight-developers] namespace itk

Stephen R. Aylward aylward at unc.edu
Mon Aug 14 20:52:07 EDT 2000


I agree with Bill that we should avoid too many macros or obscuring C++.
Namespace opening and closing is standard - yup, people can make
mistakes, but we should not address "deficites" in C++.

Stephen

Brad King wrote:
> 
> Since reason #1 below was the main benefit of the macro approach, perhaps
> this pair of macros would be better:
> 
> #define NAMESPACE_BEGIN(x)  namespace x {
> #define NAMESPACE_END(x)    }
> 
> Then we open and close the namespace with:
> 
> NAMESPACE_BEGIN(itk)
> //.........
> NAMESPACE_END(itk)
> 
> Once people start using the toolkit, we can't change the namespace's name,
> but any user who wants to can easily remove the namespace by overriding
> the macro definitions when building itk.
> 
> Also, these macros still provide the readability without compromising the
> language as much.  Mainly, it is now obvious that the namespace is called
> "itk", and not "ITK" or "Itk" or something else.
> 
> Before I make this change, I'd like some feedback.  Anyone have any other
> arguments?  I can always just change it back to the non-macro version.
> 
> -Brad
> 
> > My only concern is the over use of macros. Are we trying to define a new language? Should'n the code
> > look like C++ as much as possible?
> >
> > Bill
> >
> 
> > #define ITK_NAMESPACE_BEGIN namespace itk {
> > #define ITK_NAMESPACE_END   }
> >
> > Reasons for using macros instead of the namespace keyword include:
> >
> > 1.) Improved readability.  Although "namespace itk {" was clear,
> > a comment was required to mark the end of the namespace
> > ("}" v. "} // namespace itk"), and it is easy to forget to write the
> > comment.
> >
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers

-- 
===============================================
Stephen R. Aylward
Assistant Professor of Radiology
Adjunct Assistant Professor of Computer Science
http://www.cs.unc.edu/~aylward
aylward at unc.edu
(919) 966-9695




More information about the Insight-developers mailing list