4 ms·
> I’ve always found it interesting to consider the simplest possible spec you could give 100 programmers and receive no bugs in return. There is only one or tw
by ghoward 5y ago
> I’ve always found it interesting to consider the simplest possible spec you could give 100 programmers and receive no bugs in return.
There is only one or two https://pubs.opengroup.org/onlinepubs/9699919799/utilities/true.html#top https://pubs.opengroup.org/onlinepubs/9699919799/utilities/t... and maybe https://pubs.opengroup.org/onlinepubs/9699919799/utilities/false.html#top https://pubs.opengroup.org/onlinepubs/9699919799/utilities/f... .
Even "Hello, World!" is done wrong more often than not. An example: you should check for errors from `printf()`, as in [1].
[1]: https://stackoverflow.com/questions/12355758/proper-hello-world-in-c/12355781#12355781 https://stackoverflow.com/questions/12355758/proper-hello-wo...
- remexre 5y agoNot even both of those; I thought there famously existed some way to make GNU true return non-zero. EDIT: Yep, https://github.com/coreutils/coreutils/blob/master/src/true.c#L67-L69 https://github.com/coreutils/coreutils/blob/master/src/true....
- ghoward 5y agoHa! So it is impossible! Seriously, though, thank you for the link. That is good to know!
- Someone 5y agoBut that’s a complex program, with command-line parsing, locale usage, etc. No wonder it has bugs :-) https://en.wikipedia.org/wiki/IEFBR14 https://en.wikipedia.org/wiki/IEFBR14 was a one-byte program, but that had a bug, so it had to be doubled in size. And yes, it still exists (https://www.ibm.com/docs/en/zos-basic-skills?topic=utilities-iefbr14-utility-do-almost-nothing https://www.ibm.com/docs/en/zos-basic-skills?topic=utilities...). I wouldn’t know how large it is nowadays.