0

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?

  • 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 at 8:42
  • For glibc in particular, see also opensource.stackexchange.com/q/4496/532 – Kevin Mar 9 at 21:47
3

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, privacy policy and cookie policy

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