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(x,y) EXP(x)##EXP(y)
  8. #define IF_VOID(type,macro) CAT( IF_, SEQ((IS_##type,0)) )(macro)
  9.  
  10. #include <cstdio>
  11.  
  12. int main(int argc,char *argv[])
  13. {
  14. IF_VOID(void,printf("void"));
  15. IF_VOID(int,printf("int"));
  16. return 0;
  17. }
  18.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty