VC debugging status, assert () Usage

Source: Internet
Author: User

Assert () is a macro that is often used when debugging a program. When the program is running, it calculates the expressions in parentheses. If the expression is false (0), the program reports an error and terminates the execution. If the expression is not 0, execute the following statement. This macro often used to determine whether the program contains clearly illegal data. If the program is terminated, it will not cause serious consequences, but also facilitate searching for errors. For example, variable N should not be 0 in the program. If it is 0, an error may occur. You can write the program as follows:
......
Assert (n! = 0 );
K = 10/N;
......
Assert is valid only in the debug version. If it is compiled into the release version, it is ignored.
Assert () has similar functions. It is a function specified in the ansi c standard. An important difference between assert and assert is that it can be used in the release version.

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.