bluenorange bluenorange - 3 months ago 21
C Question

C : What is the rationale behind putting some functions into a library instead of the core language?

E.g. malloc() is a quite essential function but must be added via the standard library.


C as a language is a platform enabler and not a platform unto itself (like Java). C may be used on a lot of platforms that lack basic computer functionality so the core language is a basic as possible.

C may run on a platform that does not have a filesystem.

Malloc as normally implemented does not offer a realtime guarantee and direct memory partitioning may be a better solution than a general purpose allocator.

Placing all these functions in a library keeps the compiler simple a usable in all scenarios.