High-quality programming guide-C/C ++ chapter 15th C ++ Exception Handling Mechanism and rtti

Source: Internet
Author: User

Chapter 3 C ++ Exception Handling Mechanism and rtti

I. c ++ Exception Handling
So far, I have no experience in using the "exception mechanism" in actual projects, so I have no idea about this part. In the qt4 framework, exceptions are not recommended.
Interestingly, Google's programming specifications also suggest: "We don't use C ++ exceptions .".
Of course, it cannot be questioned that the exception handling technology of C ++ can enhance the robustness of software. For usage of exceptions, please wait for further research.

Ii. rtti (runtime type recognition)
1. In order to get the object type information at runtimeType_info, C ++ adds two operators:Typeid ()AndDynamic_cast <>.
2. type_info has three member functions: Operator = () and operator! = () And name ().

3. The typeid () operator does not need to traverse the inheritance tree. In fact, the overhead of calling the typeid () operator is equal to the overhead of dynamic binding of the virtual function.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.