The worst possible Hello World program
boredzo.org
The worst possible Hello World program
1–10 of 23 posts
Re: The worst possible Hello World program
#2And dude, don't go using the word 'worst' as lightly as that. It's dangerous - I am sure we could make it ohhh really quite worse... how about relying on some known compiler/os bugs to flip some bits somewhere, obfuscating it right up then generate some code by repeating various pointless operations (but all slightly subtly randomly different so not obvious enough to remove) to get it to say ~ 5 million lines of code? :-D
Re: The worst possible Hello World program
#3Re: The worst possible Hello World program
#4 % a.out
Hello World!
ERROR: fputs did not succeed in writing our message string (error returned: Unknown error: 0)!
A look at the man page for puts shows that the author bungled the test for error:fputs() now returns a non-negative number (as opposed to 0) on successful completion. As a result, many tests (e.g., "fputs() == 0", "fputs() != 0") do not give the desired result. Use "fputs() != EOF" or "fputs() == EOF" to determine success or failure.
That's the price for over-engineering.
Re: The worst possible Hello World program
#5This is actually quite a laugh. Compiling the author's recommended "best" hello world on Mac OS 10.6 (gcc 4.2.1) yields this: % a.out Hello World! ERROR: fputs did not succeed in writing our message string (error returned: Unknown error: 0)! A look at the man page for puts shows that the author bungled the test for error: fputs() now returns a non-negative number (as opposed to 0) on successful completion. As a resul…
Re: The worst possible Hello World program
#6This is actually quite a laugh. Compiling the author's recommended "best" hello world on Mac OS 10.6 (gcc 4.2.1) yields this: % a.out Hello World! ERROR: fputs did not succeed in writing our message string (error returned: Unknown error: 0)! A look at the man page for puts shows that the author bungled the test for error: fputs() now returns a non-negative number (as opposed to 0) on successful completion. As a resul…
Ouch. Now the article isn't just advocating overengineering, it's just plain wrong - have you contacted the author to let him know? Probably best for him to fix this up asap.
Re: The worst possible Hello World program
#7This is actually quite a laugh. Compiling the author's recommended "best" hello world on Mac OS 10.6 (gcc 4.2.1) yields this: % a.out Hello World! ERROR: fputs did not succeed in writing our message string (error returned: Unknown error: 0)! A look at the man page for puts shows that the author bungled the test for error: fputs() now returns a non-negative number (as opposed to 0) on successful completion. As a resul…
Ouch. Now the article isn't just advocating overengineering, it's just plain wrong - have you contacted the author to let him know? Probably best for him to fix this up asap.
I'll fix it in a few minutes.
Re: The worst possible Hello World program
#8Earlier quoted context omitted.
Ouch. Now the article isn't just advocating overengineering, it's just plain wrong - have you contacted the author to let him know? Probably best for him to fix this up asap.
mturmon hasn't (so far), but a friend just passed me the link to this thread. Thanks nonetheless. I'll fix it in a few minutes.
Re: The worst possible Hello World program
#9This is actually quite a laugh. Compiling the author's recommended "best" hello world on Mac OS 10.6 (gcc 4.2.1) yields this: % a.out Hello World! ERROR: fputs did not succeed in writing our message string (error returned: Unknown error: 0)! A look at the man page for puts shows that the author bungled the test for error: fputs() now returns a non-negative number (as opposed to 0) on successful completion. As a resul…
I'll fix the program.
By the way, the zip archives include a Makefile with correct compiler configuration (namely -std=c99). I tried downloading them after seeing this thread and it didn't work; I've re-uploaded them and now they download correctly, Makefiles and all. No more having to run the compiler by hand.
Re: The worst possible Hello World program
#10I don't see how "does not try to insert any values into the string" and "supplies the terminating newline" are not contradictory.