Debug宏
2016-01-06 13:39
225 查看
#include <stdio.h> #include <stdarg.h> #define DEBUG(args) printf args /////////////////////////////// void Dbg(int level, const char *message, ...) { va_list l; if (level < 2) { return; } va_start(l, message); vprintf(message, l); va_end(l); } #define DBG(arg) Dbg arg ///////////////////////////////// void Dbg2(const char *message, ...) { va_list l; va_start(l, message); vprintf(message, l); va_end(l); } #define DBG2(level, line) \ if (level < 2) {} \ else Dbg2 line #define LOGE2(line) DBG2(0, line) int main(int argc, char **argv) { //v1 DEBUG(("a%s\n", "b")); //v2 Dbg(3, "a%s\n", "b"); DBG((3, "a%s\n", "b")); //v3 DBG2(3, ("a%s\n", "b")); LOGE2(("a%s\n", "b")); return 0; }
相关文章推荐
- 微信公众平台开发--订阅、文本、单图文回复
- Oracle正则表达式函数
- oracle创建表空间和用户
- java保留两位小数
- Struts2中Action接收参数的方法
- 一周大事件:玩我的世界开公司
- Android:下拉列表Spinner(二)
- iOS事件拦截(实现触摸任意位置隐藏指定view)
- C#学习超市系统之超市商品
- Xcode使用第三方库-Cocoapods
- ContextLoaderListener作用详解
- 自制MyLineNumberReader
- 泛型类、Map...
- Android 控件收集
- Java Script 第十节课 Java Script的 while。
- 沃通CA两款根证书入Mozilla证书库(转载)
- C#学习超市系统之超市前台
- Linux定时器的使用
- python入门笔记(3)
- apache开源项目 -- tez