This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: -fno-rtti
- To: Neelakanth Nadgir <NEELAKANTH dot NADGIR at SUN dot COM>
- Subject: Re: -fno-rtti
- From: <llewelly at dbritsch dot dsl dot xmission dot com>
- Date: Mon, 13 Mar 2000 12:20:35 -0700 (MST)
- Cc: gcc-help at gcc dot gnu dot org
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]