[vtk-developers] Re: [Insight-developers] Re: BOOST_FUNCTION_COMPARE_TYPE_ID

David Cole david.cole at kitware.com
Thu Nov 29 12:07:12 EST 2007


FYI -- C++ RTTI is not enabled by default on the AIX C++ compiler..... this
is one of the reasons why we have long discouraged use of "dynamic_cast" and
type_id in the VTK code base.

See these warnings which are occurring because of the accidental sneak-in of
some dynamic_cast and type_id usage in VTK code:
http://www.vtk.org/Testing/Sites/r06n01.pbm.ihost.com/AIX00CF53-xlC/20071129-0300-Nightly/BuildWarning.html


David Cole

On 11/29/07, Mathieu Malaterre <mathieu.malaterre at gmail.com> wrote:
>
> Indeed this bug would only show up when loading the shared lib with
> RTLD_LOCAL, you cannot compare addresses anymore.
>
> Ref:
> http://gcc.gnu.org/ml/gcc/2002-05/msg00869.html
> and
> http://lists.apple.com/archives/xcode-users/2006/Feb/msg00234.html
>
> As far as I know a somewhat similar bug was found on AIX which was the
> whole reason of vtkpython...I'll have to dig in the code to see what
> was the fix.
>
> -Mathieu
>
> On Nov 29, 2007 5:44 PM, Mathieu Malaterre <mathieu.malaterre at gmail.com>
> wrote:
> > Hi there,
> >
> >   I have been struggling for a while today tracking down a bug on
> > debian stable/gcc 3.3.5 (loading the shared lib from python).
> > Basically there is a bug in the operator== for std::type_info (as far
> > as I understand), which prevent the following code from ImageIOBase to
> > work correclty (*). I found a reference in the boost code, so I assume
> > there has been some version of gcc that suffered from it:
> >
> > $ cat boost/function/function_base.hpp
> > // Borrowed from Boost.Python library: determines the cases where we
> > // need to use std::type_info::name to compare instead of operator==.
> > # if (defined(__GNUC__) && __GNUC__ >= 3) \
> >  || defined(_AIX) \
> >  || (   defined(__sgi) && defined(__host_mips))
> > #  include <cstring>
> > #  define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) \
> >      (std::strcmp((X).name(),(Y).name()) == 0)
> > # else
> > #  define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) ((X)==(Y))
> > #endif
> >
> >
> > so the question is: the bug never showed up on *any* dashboards, is it
> > still a reasonable patch to apply ?
> > And for reference the image was itk::Image< itk::Vector<float, 3>, 3>.
> >
> > Thanks
> > -Mathieu
> >
> > (*)
> > template <typename T>
> > bool
> > itkSetPixelType(ImageIOBase *This,
> >                 const std::type_info &ptype,
> >                 ImageIOBase::IOComponentType ntype,
> >                 T itkNotUsed( dummy ) )
> > {
> >   if( ptype == typeid(T) )
> >     {
> >     This->SetNumberOfComponents(1);
> >     This->SetComponentType(ntype);
> >     This->SetPixelType(ImageIOBase::SCALAR);
> >     return true;
> >     }
> > ...
> >
> > --
> > Mathieu
> >
>
>
>
> --
> Mathieu
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20071129/42d96828/attachment.html>


More information about the vtk-developers mailing list