473,320 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

disabling RTTI

Please consider the following

//file test.cpp
#include <iostream>
int main()
{
int x;
try
{
throw x;
}
catch(int x)
{
cout << "Caught\n ";
}
}
This program works fine when compiled with
g++ test.cpp
but when compile with
g++ -fno-rtti test.cpp, it crashes .

What could be the reason ? Is it that one can't one disable the rtti
option in isolation, i.e. fexception too has to be disabled ?
Jul 22 '05 #1
2 5934

"shishir" <sh*******@indiatimes.com> wrote in message
news:a0**************************@posting.google.c om...
Please consider the following
[C++ example using exceptions deleted]
This program works fine when compiled with
g++ test.cpp
but when compile with
g++ -fno-rtti test.cpp, it crashes .

What could be the reason ? Is it that one can't one disable the rtti
option in isolation, i.e. fexception too has to be disabled ?


One way to implement exceptions is to use the type_info
records that the RTTI infrastructure requires. This is not
the only way to implement exceptions, but it apparently is
being used in your compiler.

See http://tinyurl.com/33rlt for more...

Cheers!

- Risto -
Jul 22 '05 #2
shishir wrote:
Please consider the following

//file test.cpp
#include <iostream>
int main()
{
int x;
try
{
throw x;
}
catch(int x)
{
cout << "Caught\n ";
}
}
This program works fine when compiled with
g++ test.cpp
It shouldn't. You're probably using a rather old and outdated version of
g++.
but when compile with
g++ -fno-rtti test.cpp, it crashes .
It doens't here (GCC 3.3.3).
What could be the reason ? Is it that one can't one disable the rtti
option in isolation, i.e. fexception too has to be disabled ?


I don't know what older g++ versions need. You might want to have a look
into the manual.
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Rick | last post by:
Hi, I wrote a few classes recently and am writing a small GC implementation for C++. I will be implementing my own gc_ptr type maintain a list where I'll store pointers to allocated memory. I...
6
by: Kleidemos | last post by:
If I implement a simple RTTI system, more simple than C++ RTTI system for my program and this system is plus or minus: #define DEF_RTTI_BASE(name) virtual inline const char *Name(){ return...
9
by: Agoston Bejo | last post by:
Hello there, I would like to know what overheads there are to think of when using RTTI. I understand that enabling RTTI increases the sizes of the classes, but not the objects themselves. This...
2
by: denny | last post by:
Hey all, I know that dynamic_cast<> takes some time, but , for instance, is there a memoy cost associated in with it? Does it have to maintain a table in memory, thus bloating the runtime ram...
3
by: Steven T. Hatton | last post by:
I'm trying to work out a design for dynamically determining file types, and for generating new files of a given type. I'm curious to know what others think of my current strategy. Is it "so...
10
by: Neo | last post by:
what is RTTI? and how to implements it? give me sourceful link for learn and implements it (using standard C mean portable). regards, -aims
3
by: Neo | last post by:
Hi Friends, I have a question about RTTI. 1) In C++ we have vptr pointing to vtables which helps to make use of pointer as polymorphic entities. 2) Without knowing object type I can call methods...
5
by: dotNeter | last post by:
I'm studying the RTTI, and my current work is concern for how to get the self-defined type at runtime, that's exactly what the RTTI does. I mean, in my application, I built several self-defined...
2
by: Chameleon | last post by:
I know than dynamic_cast check string name of derived to base class and if one of them match, return the pointer of that object or else zero. I suppose, I dynamic_cast instead of strings, checks...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.