The Return Value of the C era is a poor abandon in the C ++ era.

Source: Internet
Author: User

The exception of C ++ comes. The return value of the C era is a poor waste in the C ++ era.

Benefits of exceptions:
1. As long as you use C ++, you will inevitably encounter exceptions. STL or simple new may run out of exceptions at any time. If you want to write a robust enoughProgram, You must handle the exception! Since sooner or later Exception Processing is required, we should enjoy the exception. Why is it so troublesome to judge the return value of a function?
2. Usage exception. YourCodeIt will be able to get along with STL, because each other is so fond of throwing exceptions, so it is very easy to resonate. STL like to get objects directly, but what your code gives STL is a return value indicating success or failure, which makes STL feel inferior. Yes, STL wants to get you, but you tell STL that you are doing the right thing. This will make people quite speechless and lead to difficulties in communication.

3. Usage exceptions reduce the amount of code, optimize labor efficiency, reduce coding time, spend more time with family members and children, promote feelings, and enjoy a better life.

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.