1

I was wondering, since the ISO standard already gives already examples for a few functions on how to implement them, but by far not all, and I am not too sure, where exactly the functionality is gotten from when compiling, due to different conditions influencing, which implementation is being used, is it the compiler shipping the standard C implementations? Is the OS providing them? Or is there a different Copyright holder involved? If there is no distinct answer, what would be the way to figure which stdlib implementation is being used when compiling?

2
  • 1
    On Linux you can use the command ldd to find out which C library a program is using. Normally Linux binaries use glibc (GNU libc) published by the FSF, but there are alternatives like newlib, diet libc, (Clang) libstdc++, etc. Each implementation has its own copyright and license terms.
    – Brandin
    Mar 9, 2019 at 8:42
  • For glibc in particular, see also opensource.stackexchange.com/q/4496/532
    – Kevin
    Mar 9, 2019 at 21:47

1 Answer 1

5

The examples for functions from the standard library in the ISO standard for the C language are meant to be illustrative of the behavior of the function and are not a prescription how the function must be implemented.

Most actual implementations of the C standard library probably have a different implementation that is optimized for the platform(s) targeted by that implementation. In that case, the authors of the library implementation (or rather, the legal entity they work for) have the full copyrights on the code.

The standard C library can be provided by both the compiler and the OS. You will have to check the compiler documentation if it is using the OS-provided library implementation or an implementation that is bundled with the compiler. For one and the same compiler, this can be different per OS or compiler build.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.