Skip to content

Instantly share code, notes, and snippets.

@mrhead
Last active October 25, 2015 21:20
Show Gist options
  • Save mrhead/40d75640cbb5848f9b61 to your computer and use it in GitHub Desktop.
Save mrhead/40d75640cbb5848f9b61 to your computer and use it in GitHub Desktop.
#define a /*
#! \
sub 'echo {print @_; print "\n"}
#' 2>/dev/null
# \
echo "my polyglot"; exit;
# \
sub puts{};
puts "my polyglot";
exit;
#*/
#include <stdio.h>
#define sub main
#define asdf ()
sub asdf { printf("my polyglot\n");}
@mrhead
Copy link
Author

mrhead commented Jul 6, 2015

What it does?

It prints my polyglot to the screen.

Why am I proud of it?

Because it is my very own polyglot and it does the same thing in four different languages:

$ cc mypolyglot.c
$ ./a.out
my polyglot
$ sh mypolyglot.c
my polyglot
$ perl mypolyglot.c
my polyglot
$ tclsh mypolyglot.c
my polyglot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment