4 ms·
I wonder why the ISO C standard is specifying who is responsible for implementing libc. That seems screwy at best. Regardless, afaik OpenBSD and FreeBSD both s
by jchw 8y ago
I wonder why the ISO C standard is specifying who is responsible for implementing libc. That seems screwy at best.
Regardless, afaik OpenBSD and FreeBSD both ship libc as part of the operating system. It makes a lot of sense, really, because libc is bound to need to make syscalls, which differ strongly depending on the kernel, whereas the user interface of libc is pretty much the same across any operating system.
- hangonhn 8y agoWould memory allocation also be hardware dependent and thus vary as well depending on what hardware the OS decides to support?
- jchw 8y agoYou mean like devices without MMUs? I think that might be the case but I'm not sure. Under Linux you need a special kernel and libc to handle such devices IIRC.
- pjmlp 8y agoBecause not every OS is an UNIX clone and C also targets bare metal.
- jchw 8y ago- afaik freestanding C specifies no standard library at all (except pure headers,) so bare metal targets providing libc are going beyond the standard. - I'm just saying it doesn't need to specify who implements the standard library. I've read the standard before and I don't really recall this coming up, I'm just assuming this assertion is accurate. (And of course, the overwhelming reality is that libc is provided by none of the compilers except Microsoft C, since Clang and GCC tend to be used with glibc.)
- pjmlp 8y agoThere is a world beyond gcc, clang and MSVC. Just out of my head, MikroElektronika, TI, Green Hills, Embarcadero, IBM, HP, Unisys, Intel, PGI.
- jchw 8y agoEven then, the comments regarding "freestanding" C runtimes are the same. Targeting bare metal puts the standard library squarely out of scope of the standard.