[Insight-developers] Re: BOOST_FUNCTION_COMPARE_TYPE_ID
Mathieu Malaterre
mathieu.malaterre at gmail.com
Thu Nov 29 12:00:51 EST 2007
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
More information about the Insight-developers
mailing list