标签:pragma macro
/* Some test definition here */
#define DEFINED_BUT_NO_VALUE
#define DEFINED_INT 1
#define DEFINED_STR "ABC"
/* definition to expand macro then apply to pragma message */
#define VALUE_TO_STRING(x) #x
#define VALUE(x) VALUE_TO_STRING(x)
#define VAR_NAME_VALUE(var) #var "=" VALUE(var)
/* Some example here */
#pragma message(VAR_NAME_VALUE(NOT_DEFINED))
#pragma message(VAR_NAME_VALUE(DEFINED_BUT_NO_VALUE))
#pragma message(VAR_NAME_VALUE(DEFINED_INT))
#pragma message(VAR_NAME_VALUE(DEFINED_STR))
definition to expand macro then apply to pragma message
标签:pragma macro
原文地址:http://zhiyuandai.blog.51cto.com/9640630/1923562