int main(void) { printf("%" xstr(AA) "d\n", 1); printf("%s\n", xstr(AFTERX(BUFSIZE))); printf("%s\n", xstr(XAFTERX(BUFSIZE))); return 0; }
void main(int argc, char* argv[]) { // for 宏参数预处理 // 宏参数中若包含另外的宏,那么宏参数在被代入到宏体之前会做一次完全的展开,除非宏体中含有#或##。 AFTERX(BUFSIZE)(); XAFTERX(BUFSIZE)(); // for # & ## // WARN_IF int divider = 0; WARN_IF(divider == 0); M_CONTATENOR(AA, BB, CC)(); common_print(M_CONTATENOR(AA, BB, CC)); char* templt = "apple = %d, banana = %d, orange = %d\n"; char* arg1 = "hello"; VARIADIC_MACRO_PRINT(templt, 1, 2, 3); VARIADIC_MACRO_FUNCTION(templt, 1, 2, 3); }