How to concatenate, evaluate and stringify macros?
问题 I am trying to stringify the substitution (evaluation) of a macro concatenation. For example: #include <stdio.h> #define FOO_ONE 12 #define FOO_TWO 34 #define BAR_ONE 56 #define BAR_TWO 78 #define MAKE_MAC(mac) // ... what to do here? void main(int argc, char *argv[]) { printf("FOO: " MAKE_MAC(FOO) "\n"); printf("BAR: " MAKE_MAC(BAR) "\n"); } The result I am seeking is: FOO: 1234 BAR: 5678 I tried a few forms, I think the best attempt is this: #define STRINGIFY(mac) #mac #define CONCAT(mac1,