This looks like code in the C language, but I am not completely sure ...
# define v putchar
# define print(x) main(){v(4+v(v(52)-4));return 0;}/*
#>+++++++4+[>++++++<-]>++++.----.++++.*/
print(202*2);exit();
#define/*>.@*/exit()
This looks like code in the C language, but I am not completely sure ...
# define v putchar
# define print(x) main(){v(4+v(v(52)-4));return 0;}/*
#>+++++++4+[>++++++<-]>++++.----.++++.*/
print(202*2);exit();
#define/*>.@*/exit()
Looks like it might even be a polyglot in C and Brainfuck and perhaps others?
it is a little polyglot for Befunge-93, Brainf*ck, Python, Ruby, Perl, and C that simply prints 404 to stdout.
http://meta.stackoverflow.com/questions/27112/amusing-404-page-not-found-images-for-trilogy-sites
As the original author of the polyglot, and the author of the accepted answer in the meta post, I feel I have the right -- nay, the duty -- to re-post the explanation here:
The easy versions are Python, Perl, and Ruby: the only code executed is
print(202*2);exit();
because they all treat #
as a line-comment. Obviously, the code prints "404" and exits the program.
The C code is fairly easy to read, but even easier if you run it through a preprocessor:
main(){putchar(4+putchar(putchar(52)-4));return 0;};exit();
Your standard main
function is declared there, and exit
is also declared as a function with an implicit return type of int
(exit
is effectively ignored).
putchar
was used because you don't need any #include
to use it; you give it an integer argument and it puts the corresponding ASCII character to stdout and returns the same value you gave it. So, we put 52 (which is 4
); then we subtract 4 and output 0
; then we add 4 to output 4
again.
+-> Effectively ignored from earlier part of code
++++++++ Put 8 in first memory location
[>++++++<-] Add 6 to second location; decrement first location;
repeat until first is 0; effectively this does 6*8 into 2nd location
>++++. Move back into 2nd location and add 4 so we have a char of 52; print it
----. Decrement 4 times to output a 0
++++. Increment 4 times and output a 4
>. Move pointer and output a null
Actually, that last line wasn't supposed to work that way. The last part was supposed to be ++++<
before the >.
Oh well, it's up there now.
Befunge is my favorite of the group. I recommend The Visual Befunge Applet if you want to see it in action.
Essentially, all the characters in define
are pushed on the stack and never used. Then v
points our instruction vector downwards. Then we push another e
on the stack, which happens to be an ASCII value of 101. Push 4 on the stack, multiply, turn right, hit the .
and print 404 to the screen. @
stops the program there.