Writing C software without the standard library
weeb.ddns.net
Writing C software without the standard library
1–10 of 188 posts
Re: Writing C software without the standard library
#2Re: Writing C software without the standard library
#3Is this ever an real issue, even on any embedded system in the last 20 years?
Re: Writing C software without the standard library
#4Still I like the idea. This is something that should be covered in a CS 102 type course. I know way to many cs guys who have no idea how to debug, let alone how their is being implemented.
Re: Writing C software without the standard library
#5Re: Writing C software without the standard library
#6Re: Writing C software without the standard library
#7[0] https://git.musl-libc.org/cgit/musl/tree/src/misc/syscall.c
[1] https://git.musl-libc.org/cgit/musl/tree/src/internal/syscal...
[2] https://git.musl-libc.org/cgit/musl/tree/src/internal/syscal...
[3] https://git.musl-libc.org/cgit/musl/tree/arch/x86_64/syscall...
Re: Writing C software without the standard library
#8Fantastic until you need to malloc. You're reimplementing libc, but at least you know what's going on at every level.
There's no doubt that this is a fun project though - if you or someone-else enjoys this type of stuff, you should definitely try your hand at writing a simple Unix kernel or similar, you'd probably enjoy it.
On that note though, the writers aversion to inline assembly is unfortunate. It's a necessary evil for this type of programming. The syntax is ugly, but it's not really that hard to get used too (Especially since the large majority of inline assembly is just a few lines long, or even just one line long). In particular, the syscall wrappers can be done in a one-line piece of inline assembly, and then you can avoid the function-call overhead for the syscall by placing the inline assembly in a `static inline` function in your headers (Or a macro if you prefer), as well as avoid the extra .S file (Which IMO is the better part - it's always easier when you don't have to mix different languages like that).
I would also add that, while I used to share the aversion for AT&T asm syntax the author does, virtually all of the assembly code out there related to linux is written in AT&T, so it's worth it to get used to it and at least be able to read it. On that note, you can use the Intel syntax in inline assembly though, if you prefer, so even if you hate AT&T with a passion you can still write inline assembly ;)
Re: Writing C software without the standard library
#9> Executables are incredibly small (the http mirror server for my gopherspace is powered by a 10kb executable). Is this ever an real issue, even on any embedded system in the last 20 years?
Re: Writing C software without the standard library
#10> Executables are incredibly small (the http mirror server for my gopherspace is powered by a 10kb executable). Is this ever an real issue, even on any embedded system in the last 20 years?