[Insight-developers] ExceptionObject Borland Compile errors

Niels Dekker niels-xtk at xs4all.nl
Wed May 28 11:05:44 EDT 2008


Brad King wrote:
> The itk SmartPointer is not designed for working with
> incomplete types.

It works fine on GCC and MSVC, as I tested beforehand.  By the time 
SmartPointer needs to access member functions of the type (in 
itkExceptionObject.cxx), the complete type definitions are available. 
So I think it's really a Borland issue.

> I suggest making the smart pointer type point at a
> LightObject (or other complete type used as a base class for the
> internal data type) and then downcast inside the .cxx file.

Good suggestion...  Still things are even more tricky: when we would 
declare ExceptionObject::m_ExceptionData as SmartPointer<LightObject>, 
we would need to #include "itkLightObject.h" within 
itkExceptionObject.h, right?  Unfortunately doing so would cause a lot 
of compile errors, in unrelated CXX files that already do #include 
"itkLightObject.h":

#include "itkLightObject.h" // error: LightObject undeclared identifier

It's because "itkLightObject.h" indirectly includes 
"itkExceptionObject.h" (via "itkMacro.h") already!  You should really 
try it yourself, because it's hard to explain.

So now I'm not entirely sure if LightObject can be used to do the 
reference counting of ExceptionObject's data, because of this Borland 
issue...  What do you think?

Kind regards, Niels







More information about the Insight-developers mailing list