[Insight-developers] namespace itk
Brad King
brad.king at kitware.com
Thu Aug 10 08:59:19 EDT 2000
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.
>
More information about the Insight-developers
mailing list