Is it possible for C preprocessor macros to contain preprocessor directives?

后端 未结 7 1291
醉话见心
醉话见心 2020-12-08 19:33

I would like to do the equivalent of the following:

#define print_max(TYPE) \\
#  ifdef TYPE##_MAX \\
     printf(\"%lld\\n\", TYPE##_MAX); \\
#  endif

prin         


        
7条回答
  •  情话喂你
    2020-12-08 20:26

    I've tried that before. The problem is that # is already reserved to stringize a macro parameter. It isn't parsed as a preprocessor token like the one in #define.

提交回复
热议问题