Both interesting projects, but other than the words 'boot sector', 'C' and 'compiler', I don't see a similarity.
This is a great demonstration of how simple the bare bones of C are, which I think is one reason I and many others find it so appealing despite how Spartan it is. C really evolved from B which was a demake of Fortran, if Ken Thompson is to be trusted.
And PS, it's "chose your own adventure". :-) I love minimalism.
Examples:
(Why does the referenced short story remind me of "There Is No Antimemetics Division"?)
Not saying we should all write boot sector code, but reading through projects like this is genuinely humbling. Great educational resource too.
On other HN posts, they're stating something like "software development is dead", "LLM as a compiler", "Do you read compiled assembly?", and so on.
While some other posts like this contain huge mechanical sympathy and literally r/w the assembly directly.
Discussed at the time: https://news.ycombinator.com/item?id=36064971
SectorC: A C Compiler in 512 bytes - https://news.ycombinator.com/item?id=36064971 - May 2023 (80 comments)
From https://news.ycombinator.com/item?id=46920922 discussion.
If you copy the clang binary to a random place in your filesystem, it will fail to compile programs that include standard headers.
PS. There left 21 bytes (21 * 0x00 - from 0x01e0 to 0x01fd). Maybe something can be packed there ;)
Maybe it's time to equip it with a C compiler...
If you're running on Linux, adjust the qemu call to use alsa rather than coreaudio.
I generated a pull request for this on Github. If the author is happy enough with my verbose shell scripting style :-) it might get included.
Fun fact, Tiny C Compiler was derived from such a C compiler submitted to the the International Obfuscated C Code Contest.
https://xorvoid.com/otcc_deobfuscated.html https://github.com/xorvoid/otcc_deobfuscated
#!/bin/sh
echo "awk: bailing out" >&2I could have sworn I remembered atoi() being defined to return 0 for invalid input (i.e. text not representing an integer in base ten).
Literal second sentence in the article, in case it wasn't incredibly obvious to people anyways:
> It supports a subset of C that is large enough to write real and interesting programs.
I'm all for more boring headlines, but this characterization is ridiculous.
was it supposed to be "<150"?
https://www.oocities.org/trentgamblin/sizehack/entries.html#...
And anyway, isn't that kind of missing the point. 512 bytes isn't much. Your comment is nearly a 5th of that budget.
Or you know, just didn't get hung up on the blatantly obvious thing not being explicitly disclaimed right in the title, only in the preamble?