Mailing List Archive


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

Re: [tlug] C puzzle



My solution is shorter. And it crashes too :-)

main;

It compiles (with warning), then the loadder tries to call main,
which is at address 0. segfault.

br.

On Wed, 2002-07-31 at 00:47, David Santinoli wrote:
> On Tue, Jul 30, 2002 at 11:29:45AM -0400, Viktor Pavlenko wrote:
> > 
> > What about the one which always crashes?
> >
> > The following program contains 25 characters, uses no library
> > functions and segfaults when run:
> >
> > main(){((void(*)())0)();}
> 
> echo 'main(){main();}' > f.c ; gcc -o f f.c ; ./f ; rm f.c f
> 
> Sooner or later it *should* get out of stack space, shouldn't it? ;-)
> 
> Ciao
>  David
> 
> 
> *************************************************
> TLUG server is hosted by Global Online Japan
> http://home.gol.com/index_e.html
> *************************************************
> 
> =================================================
> To unsubscribe from this mailing list, 
> please see instructions at
> http://www.tlug.jp/list.html
> =================================================
> 
-- 
If it happens once, it's a bug.
If it happens twice, it's a feature.
If it happens more than twice, it's a design philosophy.

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