This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: -fno-rtti


On Mon, 13 Mar 2000, Neelakanth Nadgir wrote:

> 
>  Hi,
>  a quick question,

I believe gcc@gcc.gnu.org is for gcc developer
  concerns; gcc-help@gcc.gnu.org is more apropriate for this question.

>  If a code uses RTTI, can it be compiled with -fno-rtti ?

No. RTTI  requires type_info nodes, which it uses to identify types at
  runtime. For example, dynamic_cast<> works by comparing type_info nodes.

If you compile code which uses dynamic_cast<> or typeid with -fno-rtti,
  g++ will generate an error.

> 
> Why is it that for some codes -fno-rtti decreases codesize by as
> much as 5x?

Every type in a C++ program needs a type_info node. C++ programs often
  contain many, many types. Thus the size increase.

However, in my experience, I do not think I have ever seen 5x
  increase; 15-30% (1.15x to 1.3x) is more common.

[snip]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]