Question

Currently, when a user here gets a 404, they see the following image:

polygot-404.png

Which represents the text:

# define v putchar
#   define print(x) main(){v(4+v(v(52)-4));return 0;}/*
#>+++++++4+[>++++++<-]> ++++.----.++++.*/
print(202*2);exit();
#define/*>.@*/exit()

This looks suspiciously polyglottish. Which languages does this do something interesting in?


Side thought: Is it just me, or did I find a bug in Prettify?

Was it helpful?

Solution

Line 4 with the print(202*2) is valid in any number of scripting languages like Perl, Ruby, ECMAScript (provided a suitable implementation of a print function) and probably Python.

Line 2 is there to make line 4 valid in C and Objective-C, maybe also C++ and Objective-C++.

Line 3 contains some Brainfuck, but there seems to be something else there.

I have no idea what line 1 with the v is for. Why not just call putchar directly in line 2? So, I suspect that there's another language that is somehow made valid through this line. (At first I thought about Whitespace, but there's not enough whitespace in there to be a valid Whitespace program.)

And line 5 obviously also contains some code in some highly compressed language. Maybe something in the APL family (J, K, ...) or Golfscript?

OTHER TIPS

It is C and brainf**k. They both print 404.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top