[Insight-users] Does itkSmartPointer.h need to do #include "itkMacro.h"?

Luis Ibanez luis.ibanez at kitware.com
Fri May 16 13:21:05 EDT 2008


Hi Niels,

At first view, this sounds reasonable...

It seems that we don't even need the ITK_EXPORT here,
given that the SmartPointer is a template and it is
always fully instantiated from the .h file. (e.g.
there is no implementation that goes into a .cxx file
and that need to be exported if we build a shared
library).

That is, we can remove both the ITK_EXPORT and the
#include "itkMacro.h". There may not be a need for
#include "itkWin32Header.h" either.

I'm running an experimental build with this change,
and if it goes well, I'll commit the change.



    Thanks


       Luis


----------------
Niels Dekker wrote:
> itkSmartPointer.h has an #include "itkMacro.h", which indirectly 
> includes a lot of other header files. As far as I can see, 
> itk::SmartPointer only uses one macro, ITK_EXPORT, as follows:
> 
>  template <class TObjectType>
>  class ITK_EXPORT SmartPointer
> 
> ITK_EXPORT is defined in "itkWin32Header.h", as follows:
> 
>  // ITK_EXPORT can not be used
>  #define ITK_EXPORT
> 
> So instead of #include "itkMacro.h", shouldn't itkSmartPointer.h do 
> #include "itkWin32Header.h"?
> 
> What about just removing ITK_EXPORT from itk::SmartPointer? If that 
> would be okay, the #include could simply be removed.
> 
> FYI, I was trying to fix the copy constructor of itk::ExceptionObject, 
> by having the exception data managed by an itk::SmartPointer, but I 
> couldn't get it to work because of that particular #include.  See also 
> "Suggestions for itk::ExceptionObject", 
> http://www.itk.org/pipermail/insight-users/2007-July/023056.html
> 
> Kind regards,
> 
>  Niels
> 
> -- 
> Niels Dekker
> http://www.xs4all.nl/~nd/dekkerware
> Scientific programmer at LKEB, Leiden University Medical Center
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 


More information about the Insight-users mailing list