-fno-rtti

llewelly@dbritsch.dsl.xmission.com llewelly@dbritsch.dsl.xmission.com
Mon Mar 13 11:20:00 GMT 2000


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]



More information about the Gcc-help mailing list