In my opinion the implementation of glibc (there is a bunch of good reasons for the “weirdness” and a whole lot of gcc-isms) and even the linked example from musl (with somewhat confusing #ifdef block) is a thing that should be in some kind of “System Programming” course, not in introductory course to C.
> I’ve always taught C as a side effect of teaching operating systems, embedded systems, or something along those lines....One might argue that we shouldn’t be teaching C any longer, and I would certainly agree that C is probably a poor first or second language.
So this would be an upper-level class: an introduction to C programming for people with Python/Haskell/etc experience and a decent general understanding of computer science.