Skip to content

Instantly share code, notes, and snippets.

@mvr
Created October 20, 2009 06:03
Show Gist options
  • Save mvr/214034 to your computer and use it in GitHub Desktop.
Save mvr/214034 to your computer and use it in GitHub Desktop.
cpp quine
# ifndef P
# define Q(x, y) x ## y
# define P P
# include __FILE__
# undef Q
# define Q(x, y) Q(x, y)
# endif
Q(#,) ifndef P
Q(# define Q(x, y) x ## y,)
Q(#,) define P P
Q(#,) include __FILE__
Q(#,) undef Q
Q(# define Q(x, y) Q(x, y),)
Q(#,) endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment