fork download
  1. #define IS_void 1,1
  2. #define EXP(x) x
  3. #define VAR_SECOND(x,y,...) y
  4. #define SEQ(x) VAR_SECOND x
  5. #define IF_1(y) y
  6. #define IF_0(y)
  7. #define CAT_AUX(x,y) x ## y
  8. #define CAT(x,y) CAT_AUX(x,y)
  9. #define IF_VOID(type,macro) CAT( IF_, SEQ((IS_##type,0)) )(macro)
  10.  
  11. #include <cstdio>
  12.  
  13. int main(int argc,char *argv[])
  14. {
  15. IF_VOID(void,printf("void"));
  16. IF_VOID(int,printf("int"));
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0.02s 2724KB
stdin
Standard input is empty
stdout
void