c/c++使用#define,#ifdef,#endif将debug代码分离
#include <iostream> #include<vector> //#define MY_DEBUG //需要debug时去掉注释 using namespace std; int main() { cout << "no debug\n"; vector<int> vec = {1,2,3,4,5,6,7,8,9,10}; #ifdef MY_DEBUG cout << "in debug\n"; for(auto a : vec){ cout << a << endl; } #endif // MY_DEBUG return 0; }
posted on 2018-05-23 17:14 CreatorKou 阅读(187) 评论(0) 编辑 收藏 举报