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)

  • 相关阅读:
    软件工程概论课堂测试一
    每日站立会议个人博客五
    每日站立会议个人博客四
    典型用户以及场景分析
    每日站立会议个人博客三
    每日站立会议个人博客二
    每日站立会议个人博客一
    软件工程概论第三周学习进度条
    软件工程概论第二周学习进度条
    四则运算1
  • 原文地址:https://www.cnblogs.com/BloodAndBone/p/1921680.html
Copyright © 2011-2022 走看看