fork download
  1. #include <stdio.h>
  2.  
  3. // #define COMPILING_CORE 1
  4. #define STRINGIFY_2(core) (#core)
  5. #define CONCAT_TOKENS(x, y) STRINGIFY_2(x ## y)
  6. #define STRINGIFY(core) (STRINGIFY_2(core))
  7. #define TOKENPASTE3(x, y) #x #y
  8. // #define STRINGIFY()
  9.  
  10. /*
  11.  * Concatenate preprocessor tokens A and B without expanding macro definitions
  12.  * (however, if invoked from a macro, macro arguments are expanded).
  13.  */
  14. #define PPCAT_NX(A, B) (A ## B)
  15.  
  16. /*
  17.  * Concatenate preprocessor tokens A and B after macro-expanding them.
  18.  */
  19. #define PPCAT(A, B) (PPCAT_NX(A, B))
  20.  
  21. /*
  22.  * Turn A into a string literal without expanding macro definitions
  23.  * (however, if invoked from a macro, macro arguments are expanded).
  24.  */
  25. #define STRINGIZE_NX(A) (#A)
  26.  
  27. /*
  28.  * Turn A into a string literal after macro-expanding it.
  29.  */
  30. #define STRINGIZE(A) (STRINGIZE_NX(A))
  31.  
  32. #define T1 T
  33. #define T2 1
  34. #define COMPILING_CORE 1
  35. // #define T2 1
  36. // STRINGIZE(PPCAT(T1, COMPILING_CORE)) // produces "s1"
  37.  
  38.  
  39. int main(void) {
  40. // your code goes here
  41. printf(STRINGIZE(PPCAT(T1, T2)));
  42. return 0;
  43. }
  44.  
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
((T))