Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] C puzzle



<crazy_time_before_morning_coffee>
In fact, there is a shorter one, if you cheat...

A

Then you compile with "gcc '-DA=main;' cheat.c"

But of course this solution destroys every "programming
contest", as it will be the answer for everyone.
Shortest DECSS descrambler? A
Shortest BrainF*** compiler? A

But it permits to write "correct C programs" :-)
Shortest crashing program:
gcc -DA="main(){main();}"  (if this one is the shortest).

And the A program is also the answer to any request from
your boss:
- You want an automatic trading program? We already wrote
  it. We just need some time to find the correct compiler
  options...
</crazy_time_before_morning_coffee>

Sorry for this post, I will feel better after a strong coffee ;-)

br.


On Fri, 2002-08-02 at 09:26, Viktor Pavlenko wrote:
> >>>>> "br" == bruno raoult <br@example.com> writes:
> 
>     br> My solution is shorter. And it crashes too :-)
>     br> main;
> 
> We have had the same contest at a local C/C++ group, I thought you
> might enjoy what we generated (programs posted at tlug are included
> too). Of course, Bruno is the champion :)
> 
> main(){((void(*)())0)();}
> main(){return 1/0;}
> main(){*(int*)0=0;}
> main(){int i=1/0;}
> main(int*i){*i=0;}
> main(){main();}
> main(i){i/=0;}
> main;
> 
> Viktor
> 
> 
> *************************************************
> TLUG server is hosted by Global Online Japan
> http://home.gol.com/index_e.html
> *************************************************
> 
> =================================================
> To unsubscribe from this mailing list, 
> please see instructions atain(){main();}
> http://www.tlug.jp/list.html
> =================================================
> 
-- 
Comme disait Blaise, si ça fait pas de bien, ça peut pas faire de mal.

Attachment: signature.asc
Description: This is a digitally signed message part


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links