Coder's Guild Mailing List

Self-replicating code

Posted by Eian on 1999-06-10

Seeing this bit o'code made me think of a problem that I still have yet to
solve. Basically, it is creating a program that prints out itself (its
source code). I am sure a lot of you are thinking that it would be easy,
just a bunch of printf/cout statements, but it is not.

I have really not thought about it much, but thought that I would throw it
out on this list and see what you all had to say about it...

Eian

> 
> >
> main(i){putchar(354603184>>(i-1)*5&31|!!(i<6)<<6)&&main(++i);}
> 
> Hey I saw a guy on slashdot with something similar in
> his sig (his spelt DAVE), is that where you got it
> from? How do you work out the magic number?
> 
> 
> ===
> Matty                                       .
> http://members.xoom.com/mattpratt/      _--_|\
> mattpratt@xxxxx.xxx                    /      \
> s3099239@xxxxxxx.xxx.xxx.xx            \_.--._/<--Canberra,
> W2K - The other millenium bug.               v    Australia
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 
> 


/-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\
|        -=< THIATS >=-         |
|  This is a THIATS signature.  |
|                               |
|   GNU eat your heart out!     |
|                               |
\-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-/