What is a “RTTI”?

Help and discussing programming in C and C++.

Moderator:Moderators

Post Reply
mkar
Posts:1
Joined:Tue Feb 01, 2011 6:40 am
Location:USA
Contact:
What is a “RTTI”?

Post by mkar » Tue Feb 01, 2011 6:49 am

Hello, I am an BE student and i have passed the exam of CPP subject that is my favorite and always try to learn new. I got a new word RTTI in a book but still didn't clear exactly what is? So Can you?

BenBowen
Posts:12
Joined:Tue Nov 16, 2010 2:12 am
Location:US
Contact:

Re: What is a “RTTI”?

Post by BenBowen » Tue Feb 01, 2011 10:09 pm

Sorry, doesn't ring a bell. But fortunately, I use the internet a bit more carefully!

Behold:
http://en.wikipedia.org/wiki/RTTI

Andyhhp
Moderator
Posts:387
Joined:Tue Oct 23, 2007 10:05 am
Location:127.0.0.1
Contact:

Re: What is a “RTTI”?

Post by Andyhhp » Wed Feb 02, 2011 6:45 pm

Run Time Type Identification. It is extra metadata put into each class definiton which contains the name of that class in the source code (amongst other things).

Personally, I dont find it too useful. It is designed for a base class to be able to interigate a pointer it has, and work out which subclass that pointer is.

However, that defeats the purpose of having a base class in the first place, meaning the code is probably not being written in a sensible fashon.

It does however aid debugging with the object itself storing its name, rather than the debugger having to keep track of the extra metadata in the symbol table.

~Andrew
Image

Post Reply