The first IOCCC winner declared main as a short[] of VAX machine code: http://www.ioccc.org/1984/mullender.c You could probably do the same thing in x86 and it'd work on a modern compiler.
The Shortest Crashing C Program
21–30 of 94 posts
Re: The Shortest Crashing C Program
#22The site seems down, "Error establishing a database connection"
Re: The Shortest Crashing C Program
#23Earlier quoted context omitted.
It can't be a valid C89 program. On many Harvard architecture based microprocessors data pointers and code pointers have differing size.
Different size maybe, but different busses^H^H^H^H^H^Haddress spaces definitely, and using an address on the wrong bus is a sure way to cause problems.
Re: The Shortest Crashing C Program
#24Re: The Shortest Crashing C Program
#25 main(){*(int*)0=0;}
or: main(){*""=0;}
or: main(){main();}Re: The Shortest Crashing C Program
#26Re: The Shortest Crashing C Program
#27Earlier quoted context omitted.
That's a shame. At least in one point in history, that was the shortest-known quine: http://www.ioccc.org/years.html#1994_smr
It still is, provided you follow the build procedure prescribed by the author of that quine (check the Makefile from the contest): $ rm -rf a $ cp a.c a $ chmod +x a $ ./a $
Re: The Shortest Crashing C Program
#28Earlier quoted context omitted.
That's a shame. At least in one point in history, that was the shortest-known quine: http://www.ioccc.org/years.html#1994_smr
It still is, provided you follow the build procedure prescribed by the author of that quine (check the Makefile from the contest): $ rm -rf a $ cp a.c a $ chmod +x a $ ./a $
zsh: exec format error: ./aRe: The Shortest Crashing C Program
#29It depends on the definition. You can do better than this if you define a valid C program as anything that passes though the C compiler and generates an executable. Behold the zero length program: $ touch a.c $ gcc -c a.c $ ld a.o ld: warning: cannot find entry symbol _start; defaulting to 0000000000400078 $ ./a.out Segmentation fault
Re: The Shortest Crashing C Program
#30It depends on the definition. You can do better than this if you define a valid C program as anything that passes though the C compiler and generates an executable. Behold the zero length program: $ touch a.c $ gcc -c a.c $ ld a.o ld: warning: cannot find entry symbol _start; defaulting to 0000000000400078 $ ./a.out Segmentation fault
$ ld a.o
ld: warning: -macosx_version_min not specified, assuming 10.7
Undefined symbols for architecture x86_64:
"start", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for inferred architecture x86_64