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$

1 Answer 1

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$
2
  • 1
    $\begingroup$ @LeppyR64 the 4 is ignored as any character which is not [ ] < > + - . , $\endgroup$
    – Fabich
    Jul 11, 2016 at 15:00
  • $\begingroup$ @Lordofdark I read the topic a little closer. It's really neat. $\endgroup$
    – LeppyR64
    Jul 11, 2016 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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