Standard library of C

The standard library of C is a now standardized collection of headings and routines of library used to implement current operations, such as the inputs/outputs or the management of the Character strings, in the language C. Contrary to other languages like the Pascal and PL/I, C does not include a key words incorporated at the beginning for these tasks, therefore almost all the programs written out of C need the standard library to function, would be this only to post a result.

Structure

The name and the signature of each function are described in a heading which is included by the program, but the real implementation of the functions is separate in a software Bibliothèque, which will be assembled with the remainder of the program only at the time of the linkage editing. The name and the Espace of names of the headings became common. Generally, each heading constitutes a separate file, but the organization of the implementations remains diverse. The library standard was initially provided with the Compilateur, but today it often forms part of the Operating system. Under the UNIX systems, one finds usually the bookstore standard in the file /usr/lib/ , and it bears the name of libc.a or libc.so . The files of heading, them, are in the repertory /usr/include . However, the compiler knows or are these files thus it is useless to specify it to him. Under Linux and even more generally with GCC, it is generally the bookstore Glibc which is used. As the compilers C offer often more functionalities than those specified by the standards C ISO or POSIX, a library standard provided with a specific compiler is not very compatible with the libraries standards of the other compilers for the functions not standards.

The experiment showed that most of the well designed standard library a.c. Some parts with the passing seem errors however. The function of reading of line gets and the use of scanf for reading chains in entry are the source of many overflows of plug (buffer overflows), and the majority of the guides of programming recommend to avoid the use of it. Another old-fashioned thing is strtok, a conceived function as a lexical Analyseur primitive but which is enough “fragile” and difficult to use.

History

Unix and the computer programming language C were created by the laboratories AT&T and Bell (AT&T' S Bell Laboratories) at the end of the Années 1960 and at the beginning of the Années 1970. The language C primitive did not provide functionalities incorporated like the operations of inputs/outputs (contrary to the traditional languages like Pascal and FORTRAN). With time, the communities of users of C shared ideas and implementations of what we now call the standard library of C to provide these functionalities. Many of these ideas were built-in the standardized definition of the computer programming language C.

During the decade 1970, C became popular. Many universities and organizations created their own variations of this language for their clean projects. In years 1980 of the compatibility issues between the various implementations of C appeared.

Standards ANSI and ISO

In 1983 the American national institute of the standards (American National Standards Institute (ANSI)) formed a committee to establish a standardized specification of C, known under the name of “C ANSI”. This work culminated with the creation of the standard C89 in 1989. Part of the resulting standard was a whole of functions of library called standard library C ANSI ( ANSI C standard library ). This standard became International standard in 1990, and is also known like C ISO (ISO C) .

Later revisions of the standard C ISO added new functions and new headings to the library. The support of these extensions varies according to the implementations. The headings iso646.h , wchar.h , and wctype.h were added with the normative amendment 1 (Normative Amendment 1), shortened below by Amd.1 , which constitutes an addition to the standard C ratified in 1995. The headings complex.h , fenv.h , inttypes.h , stdbool.h , stdint.h , and tgmath.h were added with the C99 , a revision of the standard C published in 1999.

The library standard C ISO consists of 24 heading S which can be included in a project of programmer with a simple directive. Each heading contains declarations of functions, definitions of the types and macros. The contents of these headings are described below.

Extensions

In comparison with other languages (for example Java), the standard library C of the ISO standard is tiny. It provides an elementary play of mathematical functions, handling of chains, conversion of the types, and Entrée/sortie handling the files and the terminals. It does not include basic standard of “types of containers” like does it the Library of Standard Models C++ (Standard Template Library) of the language C++). It leaves side the graphic environments (Graphical User Interface, GUI), the tools network, the functions of synchronization between tasks, and the profusion of other functionalities that Java provides out of standard. The principal advantage of small a library standard is that it is much easier to provide a functional environment for the C ISO than for the other languages, and the wearing of applications in language C worms of new platforms relatively fast east thus.

Many others libraries were written to develop functionalities equivalent to those provided by other languages in their standard library. For example, the project of environment of office GNOME developed the Toolbox GIMP (GIMP ToolKit, GTK) and the Glib, a library which contains containers of structures of data, and there are many of other known goods examples. Of this variety of libraries available, certain toolboxes showed through the time of the higher capacities. The major disadvantage is that they often do not function particularly well together, the programmers are often obliged to juggle with several different libraries, and certain functionalities can be present in different forms in each particular platform, sometimes even within the same important software.

Headings of the library C ISO

assert.h : The macro assert contains, used to help to detect inconsistencies of data and other types of bugs in the versions of Débogage of a program.

complex.h : To handle the Complex numbers (introduced by C99).

ctype.h : Functions used to classify the characters quickly, or to convert between capital letters and tiny in a way independent of the system of coding of the characters) (character set) used (ASCII among Anglo-Saxons, ISO 8859-1 generally for French-speaking people, but of the implementations using EBCDIC is also known).

errno.h : Together (or generally subset) of the error codes returned by the functions of the library standard through the variable errno.

fenv.h : To control the environment in Floating decimal point (floating-point) (introduced by C99).

float.h : Contains constants which specify the properties of the numbers in Floating decimal point which depend on the implementation, such as the minimal difference between two numbers in floating decimal point different (xxx_EPSILON), the maximum number of figures of precision (xxx_DIG) and the interval of the numbers which can be represented (xxx_MIN, xxx_MAX).

inttypes.h : For precise conversions between whole types (introduced by C99).

iso646.h : To program with the character set ISO 646 (introduced by Amd.1).

limits.h : Contains constants which specify the properties of the whole types which depend on the implementation, like the intervals of the numbers being able to be represented (xxx_MIN, xxx_MAX).

locale.h : To adapt to various cultural conventions.

math.h : To calculate current mathematical functions. C99 added many mathematical functions, to converge in particular with the standard CEI 559 known as also IEEE 754.

setjmp.h : To carry out nonlocal instructions goto (kinds of Exception S).

signal.h : To control the signals (exceptional conditions asking an immediate processing, for example signal of the user).

stdarg.h : To create functions with a variable number of arguments.

stdbool.h : To have a kind of the Boolean type (introduced by C99).

stdint.h : Defines various types of entireties, it is a subset of inttypes.h (introduced by C99).

stddef.h : Defines several useful types and macros (ex: NO ONE ).

stdio.h : The central capacities of input/output of the language C. This file provides declares the function Printf .

stdlib.h : To carry out various operations of which conversion, the generation of pseudo-random numbers, the allowance of memory, process control, the management of the environment and the signals, research and sorting.

string.h : To handle the Character strings (that which are managed…)

tgmath.h : For mathematical operations on generic types (introduced by C99).

time.h : To convert between various formats of date and hour.

wchar.h : To handle the broad characters (wide tank), necessary to support a great number of languages and singularly Unicode (introduced by Amd.1).

wctype.h : To classify the broad characters (introduced by Amd.1).

The standard library in C++

See also: Amorce=voir the detailed article, standard Library of C++

The computer programming language C++ takes again the functionalities of the Bibliothèque standard C ISO, but it made several modifications there, like transforming the names of the headings of xxx.h into cxxx (however, the names in the style C are always available, although out-of-date), and placing all the identifiers in the Espace of names (namespace) std.

Random links:Secrecies of the volcano | Daisuke Ohata | Rugby flag | Sharp | Evernham Motorsports | Jazz_libre