c++忽略断言
#include <iostream>
#include <cassert>
using namespace std;
int main(int argc, char const* argv[]) {
int a = 123;
int b = 123;
assert(a != b);
cout << a << b << endl;
return 0;
}
g++ -std=c++11 -DNDEBUG -g /home/qiumc/workspace/cpp/demo/test_base.cpp -o /home/qiumc/workspace/cpp/demo/bin/test_base
必须有-DNDEBUG选项,才可以禁用断言的执行