debug 开关

来源:互联网 发布:saas 系统架构源码 编辑:程序博客网 时间:2024/06/02 21:43
#ifndef _TRACE_
#define _TRACE_
#include <string>
using namespace std;
 
#define DEBUG_SWITCH  //调试开关  调试时打开 不用时关闭就OK了
#ifdef DEBUG_SWITCH
void display(const string&);  //调试语句放在此处
#else
void display(const string&);
#endif
#endif _TRACE_
 
#include "trace.h"
#include <iostream>
string ssexport("message");
#ifdef DEBUG_SWITCH
void display(const string&) {
 cout << "debug information  " << ssexport <<endl;
}
#else
void display(const string&) {
 cout << "normal information  " << ssexport <<endl;
}
#endif
void main() {
 display(ssexport);
 return;
}
原创粉丝点击