扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
#define DEBUG #ifdef DEBUG 调试代码 #endif |
#include<iostream> #include <string> using namespace std; bool debug =false; int main(int argc,char*argv[]) { for(int i=0;i<argc;i++) if(string(argv[i])==“--debug=on“) debug = true; bool go=true; while(go) { if(debug) { 调试代码 }else {} } } |
#define PR(x) cout<<#x”=”<<x<<'\n' |
#include< assert> using namsapce std; int main() { int i=100; assert(i!=100); //Fails } 当调试完毕后在#include<assert>前加入#define NDEBUG即可消除红产生的代码 } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。