Standard library

Under a standard library is a collection of standard functions, classes or templates of a programming language.

Almost all popular programming languages ​​such as C, C , C #, Java, Delphi and Python offer a comprehensive standard library. If, therefore, a compiler conform to the standards of a programming language, he must also supply the standard libraries.

Background for the concept of the standard library are the abstraction of platform details (eg Ein-/Ausgabe ), that is increasing the portability, and the standardized provision of frequently used data structures, algorithms and functionality (eg sorting).

Also, to simplify the actual language definition the use of a standard library. For example, have functions for screen output not be defined as new keywords. The orthogonality of the language can be increased because, for example, functions from the standard library functions are normal, so may be used in all places where normal functions are allowed ( eg, function pointers ).

In some programming languages, the use of a standard library enables their easy replacement, for example, can be used on a good performance or an optimized on facilitated debugging version either.

For use in embedded systems such as large parts of the standard library can often be left out entirely, which means they are not also included in the generated executable programs, making the programs produced are smaller and provide fewer demands on their runtime environment. So all functions for screen output can be omitted without replacement, for example, screen -less systems mostly. Programs that run on the operating system less systems (such as simple control or simple calculator) or those that are themselves an operating system can dispense with the standard library completely. Under these conditions, a high-level language can then serve as a more comfortable replacement for assembly language. The first almost entirely in a high level language operating system, Unix, for example, was made possible by the clear separation of the core language and standard library in the then new programming language C.

Example

A simple console output in C ( programming language) can be implemented on all C -compliant platforms as follows:

# include int main (void ) {     printf (" Hello world \ n " );     return 0; } Here, the printf () part of the C standard library stdio.h is with the header file. Binds to this in his program, you can write portable program be without regard to the present platform.

In contrast, the function writeln () to display output in Pascal (programming language) is not part of a standard library, but part of the language definition. The screen output in Python is not implemented via a function, but print on the command that is part of the language definition.

  • Library (programming)
745230
de