assert用法

白柒 / 2024-01-25 / 原文

include <iostream>
// 注意:如果想取消使用assert,NDEBUG必须在include <cassert>前
// 或者在编译时候加,g++ assert用法.cc -DNDEBUG
// #define NDEBUG
#include <cassert>
using namespace std;

int main(int argc, const char** argv) {
    assert(argc == 2);
    cout<<"---------------"<<endl;
    return 0;
}