Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-08-13 12:24:24


AMDG

Anteru wrote:
> I just upgrade to Boost 1.36, and while I'm not using
> Boost::exception, it gets included somewhere (gotta investigate that).
> That's no problem, but as my project does not use RTTI, but
> Boost::exception does, I'm getting warnings that the typeid() operator
> is used.
>
> Happens at two lines,
>
> Q:\Boost\include\boost/exception/exception.hpp(74) : warning C4541:
> 'typeid' used on polymorphic type 'boost::exception' with /GR-;
> unpredictable behavior may result
>
> Q:\Boost\include\boost/exception/exception.hpp(81) : warning C4541:
> 'typeid' used on polymorphic type 'boost::exception' with /GR-;
> unpredictable behavior may result
>
> Is there any way to disable this? After all, I'm not using
> boost::exception specifically, and I don't want to enable RTTI just to
> get rid of the warning. I'm fine if the diagnostic message becomes
> garbage then, after all, one usage is just to get the name of the
> class (typeid(*this).name), which may even return bogus results as
> typeid is not required to return some meaningful name.

The warning ought to go away if you compile with -DBOOST_NO_TYPEID,
however, that has the side-effect of disabling Boost.Exception completely.

I'm pretty sure that the only effect will be that diagnostic_information
will
not return as useful a string.

You can either edit the header to suppress the warnings locally
or suppress the warning around the header.

#pragma warning(push)
#pragma warning(disable: 4541)
#include <boost/exception/exception.hpp>
#pragma warning(pop)

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net