zoukankan      html  css  js  c++  java
  • define宏定义

    #include <stdio.h>
    #include <stdlib.h>
    #include <stdarg.h>
    #include <string.h>
    #include <signal.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <linux/capability.h>

    #define GETARG(a,x) (a->x##_arg)


    static int debug = 0;


    #define __die(condition,format,...) do { \
                                            if(condition) {\
                                                fprintf(stderr,"[error:%04d] ", __LINE__);\
                                                fprintf(stderr, format "\n", ##__VA_ARGS__ ); \
                                                exit(1);\
                                            } \
                                        } while(0)


    #define __fail(format,...) __die(1,format,##__VA_ARGS__)


    #define __abort(r,condition,format,...) do { \
                                                if(condition) {\
                                                    fprintf(stderr,"[error:%04d] ", __LINE__);\
                                                    fprintf(stderr, format "\n", ##__VA_ARGS__ ); \
                                                    return r;\
                                                } \
                                            } while(0)


    #define __debug(format,...) do { \
                                    if(debug){\
                                        fprintf(stdout,"[debug:%04d] ", __LINE__);\
                                        fprintf(stdout, format "\n", ##__VA_ARGS__ ); \
                                    } \
                                } while(0)


    #define __error(format,...) do { \
                                    fprintf(stderr,"[error:%04d] ", __LINE__);\
                                    fprintf(stderr, format "\n", ##__VA_ARGS__ ); \
                                } while(0)

  • 相关阅读:
    cmake的find_package()简单总结
    C++的模板类:不能将定义与声明写在不同文件中
    C++的模板类:不能将定义与声明写在不同文件中
    SLAM的评测工具evo
    ubuntu安装opencv3.2
    ROS的Target Platforms
    git push的时候.gitignore不起作用的解决方法
    利用zed相机为rtabmap_ros录制rosbag包及其使用
    .pcd格式点云文件的显示
    记录一下mariadb设置主从同步的过程[虚拟机测试]
  • 原文地址:https://www.cnblogs.com/BloodAndBone/p/1921680.html
Copyright © 2011-2022 走看看