DEBUG测试

这几天看一个ros软路由的的API借口的C++实现看到一个关于DEBUG的测试,第一次见,感觉挺实用的,记录一下:

#include<iostream>
#include <stdio.h>
#define DEBUG 1

using namespace std;

int main()
{
    DEBUG ? printf("hello
") : 0;
    return 0;
}

DEBUG定义为大于0的数就打印一下,定义为0就不打印,可以随时查看程序的运行状况。

原文地址:https://www.cnblogs.com/DamonBlog/p/3891278.html