Use-DEBUG for code debugging

Source: Internet
Author: User

Recently, I was writing a linux c program. Because it is based on someone else's WebKit project, debugging is really troublesome. Every time I modify it, I need to compile the library, which is slow. A lot of information is printed, and it is useless to delete one item after debugging. After deletion, it is found that you still need to print those deleted items, after learning about debugging, we can get a better Debugging Technique: Define DEBUG.

The method is to first define various debugs, such as # define DEBUG_FILTER = 2;

Then, if you want to debug the filter, you can use

[Cpp]
# Ifdef DEBUG
If (DEBUG & DEBUG_FILTER ){
// Show some debug info
}
# Endif
Compile with the parameter-DEBUG = 2. This method can achieve a variety of debugging operations, which is very convenient.


Author: bupthua

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.