8
$\begingroup$

I tried to open an non existent page on stackoverflow and received "Page Not Found" warning however didn't understand what the code next means. Do you know what SO try to tell? enter image description here

$\endgroup$
12
$\begingroup$

This is polyglot code : it works in several languages. This one is valid in in C, Python, Perl, Ruby, Befunge-93, and Brainf*ck.

In Python/Perl/Ruby the only code that gets executed is print(202*2);exit();.
This means it shows 404 then exists the page.
The rest is commented code because of the '#'.

In C, the code executed code is:

main(){putchar(4+putchar(putchar(52)-4));return 0;};exit();  

Brainf*ck is an esoteric programming language which only read 8 symbols : [ ] < > + - . , so the code read is :

+-> 
++++++++
[>++++++<-]
>++++.
----. 
++++. 
>.

I didn't come up with this on myself, but had the same curiosity some time ago and found this answer https://meta.stackoverflow.com/a/252187/2047249 on meta stackoverflow.
That answer explains it better than I ever could.

$\endgroup$
  • $\begingroup$ If I'm not mistaken, it's not Brainfuck, there's a four in the character set. $\endgroup$ – LeppyR64 Jul 11 '16 at 14:54
  • 1
    $\begingroup$ @LeppyR64 the 4 is ignored as any character which is not [ ] < > + - . , $\endgroup$ – Fabich Jul 11 '16 at 15:00
  • $\begingroup$ @Lordofdark I read the topic a little closer. It's really neat. $\endgroup$ – LeppyR64 Jul 11 '16 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.