answersLogoWhite

0


Best Answer

RTTI is runtime type information. It is a basic requirement of the dynamic_cast operator in order to ensure all casts between polymorphic objects within a class hierarchy are done safely. Other cast operators such as safe_cast also utilise RTTI. However, RTTI has an overhead that can be detrimental to performance thus RTTI is often utilised in debug code to verify C-style casts in release code (such as reinterpret_cast) are always done safely. Both static_cast and reinterpret_cast are inherently unsafe, however static_cast does invoke user-defined conversions, whereas reinterpret_cast does not, and should only be used as a last resort. But try telling Microsoft that...

In many cases, RTTI can be eliminated completely by utilising a well-designed class hierarchy with virtual interfaces that avoid the need to cast between object types. In other words, it should not be necessary for any base class to even be aware of any of its derived class' types (let alone their specialities) in order to use them. By calling virtual methods, casting between types is done safely and automatically, Behind the Scenes, by virtue of the virtual table. Moreover, a v-table has a much lesser overhead than RTTI.

That said, there will be times when RTTI is the only solution to a problem, especially when working with legacy code and libraries for which you have little or no control over. If there's ever any doubt about what a pointer is really pointing at, use RTTI. Better safe than sorry.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

RTTI stands for Run Time Type Information. It is a mechanism where running code can know type information about a class, such as when given a pointer to a virtual base class that contains the address of a different, derived class.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is rtti in c plus plus programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why study c plus plus programming?

we are using c plus plus programming for developing object oriented programing software.


Differentiate C plus plus and Turbo C?

Turbo C is a software where C or C++ programming environment resides in.But C++ is itself a programming language.


Is c plus plus a modular programming?

No, but it does support modular programming through namespaces.


What are the two major types of programming languages in c plus plus?

Object oriented programming and structured programming.


What is the purpose of C plus plus?

Computer programming.


What is c plus plus primarily used for?

Programming.


What is the significance of c plus plus?

C++ is an object oriented programming language


What is the best website for C plus plus programming?

www.cplusplus.com


What is the use of c plus plus in banks?

Programming language.


Algorithm of push and pop in c plus plus?

pop push c++ programming


Is NET programming is update from C plus plus programming?

No. .NET programming is Microsoft-specific, similar to Java in some respects, but it is non-portable. C++ is a general purpose and cross-platform programming language.


Is there any difference between turbo c and c plus plus?

turbo c is a compiler and c++ is a programming language.