Skip to content

Instantly share code, notes, and snippets.

@fmobus
Created August 14, 2014 21:00
Show Gist options
  • Save fmobus/8f1a96d142ebee99059c to your computer and use it in GitHub Desktop.
Save fmobus/8f1a96d142ebee99059c to your computer and use it in GitHub Desktop.
#include <stdio.h>
#define _STR(X) #X
#define STR(X) _STR(X)
#define exec(X)
exec('def DECL(x):global s;s=x')
#define DECL(X) X
#define s \
DECL("#include <stdio.h>\n#define _STR(X) #X\n#define STR(X) _STR(X)\n#define exec(X)\nexec('def DECL(x):global s;s=x')\n#define DECL(X) X\n#define s \\\nDECL(%s)\n#undef exec\n#define exec(X) int main(){printf(s,STR(s));return 0;}\nexec('print s%%repr(s),')\n")
#undef exec
#define exec(X) int main(){printf(s,STR(s));return 0;}
exec('print s%repr(s),')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment