Differences between assert and verify

Source: Internet
Author: User

I didn't want to talk about it. This is actually a very basic problem. However, when debugging the product bug in the past two days, I found that the problem was caused by improper use of assert. Of course, the problem code is not written by me.

 

This bug does not appear in the debug version, but in the release version. The reason is that a very important function call is placed in assert. Assert is willing to check the return value of this function call. However, the person who writes the Code ignores the vice president of assert. As a result, a bug occurs in the release version. It took me three days to reproduce and debug the bug.

 

In this case, the correct and reasonable method is to use the expressions in Verify and verify to execute at runtime. Therefore, there are no side effects.

 

Remember.

 

 

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.