Chinaunix首页 | 论坛 | 博客
  • 博客访问: 862906
  • 博文数量: 102
  • 博客积分: 7086
  • 博客等级: 少将
  • 技术积分: 2245
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-18 11:01
文章分类

全部博文(102)

文章存档

2012年(2)

2011年(1)

2010年(21)

2009年(31)

2008年(47)

我的朋友

分类: LINUX

2009-03-03 19:44:20

#ifdef DEBUG
#define ASSERT(exp)                                                     \
        do {                                                            \
          if (!(exp)) {                                                 \
            fprintf(stderr, "[ASSERT!][%s:%s:%d]: %s\n",                \
                    __FILE__, __FUNCTION__, __LINE__, #exp);            \
            abort();                                                    \
          }                                                             \
        } while (0)
#define ERROR(...)                                                      \
        {                                                               \
            fprintf(stderr, "[ERROR  ][%s:%s:%d] ",                     \
                    __FILE__, __FUNCTION__, __LINE__);                  \
            fprintf(stderr, __VA_ARGS__);                               \
        }
#define WARNING(...)                                                    \
        {                                                               \
            fprintf(stderr, "[WARNING][%s:%s:%d] ",                     \
                    __FILE__, __FUNCTION__, __LINE__);                  \
            fprintf(stderr, __VA_ARGS__);                               \
        }
#define INFO(...)                                                       \
        {                                                               \
            fprintf(stdout, "[INFO   ][%s:%s:%d] ",                     \
                    __FILE__, __FUNCTION__, __LINE__);                  \
            fprintf(stdout, __VA_ARGS__);                               \
        }
#else
#define ASSERT(exp)
#define ERROR(...)
#define WARNING(...)
#define INFO(...)
#endif
阅读(2675) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~