博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

DEBUG测试

Posted on 2014-08-04 23:37  勇敢的鑫  阅读(173)  评论(0编辑  收藏  举报

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

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

using namespace std;

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

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