3 ms·
The post doesn't say he doesn't use libc; it says that he tries to minimize his use of it. It's very difficult to entirely avoid libc. musl and glibc are imple
by woodruffw 4y ago
The post doesn't say he doesn't use libc; it says that he tries to minimize his use of it. It's very difficult to entirely avoid libc.
musl and glibc are implementations of libc, not alternatives to it.
- eqvinox 4y agoglib != glibc; glib is Gtk/GNOME's OS-independent wrapping layer and in fact an alternative to using libc functions directly. E.g. here is glib's take on strcmp() as entry point: https://docs.gtk.org/glib/func.strcmp0.html https://docs.gtk.org/glib/func.strcmp0.html
- woodruffw 4y agoI know that; I assumed from context ("Musl, glib") that the GP has probably just dropped the "c" by accident, since musl is a libc implementation.
- mgaunard 4y agohow is it difficult to avoid libc? All you need are the system calls of your kernel. You don't need libc to call those.
- woodruffw 4y agoRelatively little of libc overlaps with the system call space: there's some I/O and a little bit of stuff that could be done with a system call (like time), but traditionally aren't for both concern separation and performance reasons. As a small example: `strtok` is simultaneously a very useful function and one that's annoying to use correctly (much less independently implement correctly). It isn't a system call.
- mgaunard 4y agostrtok is a trivial and not particularly good function, in part due to its poor API. You can write a better one in minutes (which is incidentally less than the time to understand the corner cases of this function's behaviour)