15

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?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
SamB
  • 9,039
  • 5
  • 49
  • 56
  • 1
    Flag for alt.se.prog; Possible duplicate of two meta questions: [What's the joke in the Stack Overflow 404 page code?](http://meta.stackexchange.com/questions/28625/whats-the-joke-in-the-stack-overflow-404-page-code)" and "[Amusing 404 "Page Not Found" Images for Trilogy sites?](http://meta.stackexchange.com/questions/27112/amusing-404-page-not-found-images-for-trilogy-sites)". – Cole Tobin Apr 22 '13 at 16:52
  • 1
    http://meta.stackexchange.com/questions/27112/amusing-404-page-not-found-images-for-trilogy-sites – Freelancer Jun 05 '13 at 07:02
  • Older thread, more detailed: http://meta.stackoverflow.com/questions/252184/whats-the-joke-in-the-stack-overflow-404-page-code – Nayuki Jul 06 '15 at 18:07

2 Answers2

9

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

Cole Tobin
  • 9,206
  • 15
  • 49
  • 74
Iain
  • 2,259
  • 1
  • 16
  • 18
  • The first part of the line with the Brainfuck is something else. – ohmantics Dec 02 '10 at 00:50
  • @ohmantics: Actually, there are (at least) two lines with (important) Brainfuck on them. (Technically line 2 has some, but its just the `+` and the `-` and those obviously cancel each-other out.) At least, I *think* line 5 is important somehow... – SamB Dec 02 '10 at 00:55
  • 1
    In fact, I'm also inclined to guess that the strange use of spaces/tabs might also be Whitespace. – ohmantics Dec 02 '10 at 00:57
  • @ohmantics: Unfortunately, the distinction between spaces and tabs is not preserved very well by the rasterization + OCR process – SamB Dec 02 '10 at 00:59
  • The loops on the third line seem to serve no purpose. – ohmantics Dec 02 '10 at 01:01
  • @ohmantics: I think it's the standard "build a constant by multiplying" trick, actually. (And it's just one loop.) – SamB Dec 02 '10 at 01:08
  • 2
    Those Brainfuck loops are part of the Befunge version. – ohmantics Dec 02 '10 at 01:08
  • 2
    -1 it's more than C and brainf***. It's also valid in many scripting languages like Perl. – Cole Tobin Apr 22 '13 at 16:58
6

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?

Jörg W Mittag
  • 363,080
  • 75
  • 446
  • 653