Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-08-14 09:58:54


Emil Dotchevski:
> On Wed, Aug 13, 2008 at 12:48 PM, Anteru
> <newsgroups_at_[hidden]> wrote:
>> Emil Dotchevski schrieb:
>>>
>>> Isn't this a rare configuration anyway, that disables RTTI but enables
>>> exceptions? I mean, some form of RTTI is needed for exception handling
>>> anyway so it's not completely turned off as long as exceptions are
>>> enabled.
>>
>> Well, with VC++ at least, you can have exceptions without enabling RTTI.
>> If
>> you have your own RTTI rolled out, having the standard RTTI enabled is
>> not
>> that useful (for example, MFC comes with a custom RTTI implementation).
>
> You may disable RTTI as much as you want, if you enable exception
> handling, something like typeid is in ur code, catching ur eksepshons.
> :)

In practice, the reason to disable RTTI is simple: it leads to smaller
executables. Most of the size penalty comes from the typeid().name()
strings, which need to be emitted conservatively for every polymorphic type.

Even on compilers such as MSVC that use type string comparisons to allow
exceptions to be caught across a DLL boundary, type strings only need to be
emitted for every base class of the operand of throw when RTTI is off.


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