zoukankan      html  css  js  c++  java
  • c++之调试帮助

    c++之调试帮助

    assert()

    assert(expr): 如果表达式为假, assert输出信息并终止程序。如果为真,assert什么也不做。

    NDEBUG

    #include <iostream>
    
    int main(int argc, char** argv)
    {
      int a = 1, b = 2;
      if (a < b)
      {
        std::cerr << "Error occur in " << __FILE__ << " File; " << std::endl 
                  << "in " << __func__ << " Function; at " << __LINE__ << " Line; " << std::endl
                  << "Compile on " << __DATE__ << "  at  " << __TIME__ << std::endl;
      }
      return 0;
    }
    
    Error occur in /home/liuzhiyang/workspace/unit_test/src/unit_test/src/cpp_test.cpp File;
    in main Function; at 35 Line;
    Compile on Dec 25 2018  at  19:18:01
    

    __FILE__ : 存放文件名的字符串字面值

    __LINE__:存放当前行号的整形字面值

    __func__: 存放当前函数名的字符串字面值

    __DATA__: 存放文件编译日期的字符串字面值

    __TIME__: 存放文件编译时间的字符串字面值

  • 相关阅读:
    CF 336494 C. Meme Problem
    MySql备份
    MySQL索引背后的数据结构及算法原理
    show profile 开启权限
    示例数据库
    索引使用策略及优化
    shiro权限登录案例
    Swagger技术
    Shiro框架
    shiro授权管理
  • 原文地址:https://www.cnblogs.com/ChrisCoder/p/10175967.html
Copyright © 2011-2022 走看看