Live data from Hacker News

The worst possible Hello World program

boredzo.org

21–23 of 23 posts

Re: The worst possible Hello World program

#21
post #16

The weirdest part, looking at it five years later, is that the page shows usage of and talks about puts, while the “Best Possible” code in the zip archive uses fputs. Unless anyone can think of a reason not to use puts, I'll change the zipped “Best” example over to use it after I get it both working and failing properly.

I find keeping the semantics of puts in my working memory to be harmful. The problem is that whereas (for instance) printf(...) is essentially an abbreviation for fprintf(stdout, ...), puts adds a newline whereas fputs does _not_. This is a headache to keep track of. The result of this is that I always use fputs to write a plain C string to a stdio handle, specifying stdout explicitly and adding newlines if needed, a…

An inconvenient convenience. An excellent point, and just the sort of feedback I'd been waiting for; thank you. I'll publish the revised “Best” example shortly with fputs in place, and update the page accordingly.

Re: The worst possible Hello World program

#22
I've updated the page to version 0.3, with a fixed and improved “Best” example and some improvements to the text, based mostly on the feedback from comments here. To all who've commented so far: Thank you.

In a few days, if I don't forget, I'll appoint whatever the page and samples look like by then as 1.0. Leaving things pre-1.0 bugs me more now than it did back when I originally published this.

Post reply on HN