definition to expand macro then apply to pragma message

努力尽今夕,少年犹可夸。这篇文章主要讲述definition to expand macro then apply to pragma message相关的知识,希望能为你提供帮助。
/* 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))
【definition to expand macro then apply to pragma message】#pragma message(VAR_NAME_VALUE(DEFINED_STR))



    推荐阅读