Citizendia

The C standard library (also known as libc) is a now-standardized collection of header files and library routines used to implement common operations, such as input/output and string handling, in the C programming language. In Computer programming, particularly in the C and C++ programming languages a header file or include file is a file, usually in In Computer science, a library is a collection of Subroutines used to develop Software. In Computing, input/output, or I/O, refers to the communication between an Information processing system (such as a Computer) and the outside In Computer programming and some branches of Mathematics, a string is an ordered Sequence of Symbols. tags please moot on the talk page first! --> In Computing, C is a general-purpose cross-platform block structured Unlike other languages such as COBOL, Fortran, and PL/I, C does not include builtin keywords for these tasks, so nearly all C programs rely on the standard library to function. COBOL (ˈkoʊbɒl is one of the oldest programming languages still in active use Fortran (previously FORTRAN) is a general-purpose, procedural, imperative Programming language that is especially suited to PL/I ("Programming Language One" ˌpiːˌɛlˈwʌn is an imperative computer Programming language designed for scientific engineering In Computer programming, a keyword is a Word or Identifier that has a particular meaning to the Programming language.

C Standard Library headers
  • assert.h
  • complex.h
  • ctype.h
  • errno.h
  • fenv. asserth is a Header file in the standard library of the C programming language that defines the C preprocessor macro assert( complexh is a Header file in the standard library of the C programming language that defines functionality for Complex arithmetic. TemplateC_Standard_library --> The header ctypeh in the ANSI C Standard Library for the C programming language TemplateC_Standard_library --> errnoh is a Header file in the standard library of C programming language. h
  • float.h
  • inttypes.h
  • iso646.h
  • limits.h
  • locale. TemplateC_Standard_library --> The header floath in the C Standard Library for the C programming language contains The inttypesh file is a C header file that is part of the C standard library and API The iso646h header file is part of the C standard library. It was added to this library in a 1995 amendment to the C90 standard TemplateC_Standard_library --> limitsh is the header of the general purpose standard library of the C programming language h
  • math.h
  • setjmp.h
  • signal.h
  • stdarg.h
  • stdbool.h
  • stddef.h
  • stdint.h
  • stdio.h
  • stdlib.h
  • string.h
  • tgmath. TemplateC_Standard_library --> mathh is a header file in the standard library of C programming language designed for setjmph is a header defined in the C standard library to provide "non-local jumps" ( Control flow) outside of the normal function call and return TemplateC_Standard_library --> signalh is a Header file defined in the C Standard Library to specify how a program TemplateC_Standard_library --> is a header in the C standard library of the C programming language TemplateC_Standard_library -->The header stdboolh in the C Standard Library for the C programming language contains stddefh is a Header file in the Standard library of the C programming language which defines the Macro NULL and the types Ptrdiff_t stdinth is a Header file in the C standard library introduced in the C99 standard library section 7 TemplateC_Standard_library --> stdioh, which stands for "standard input/output header" is the header in the TemplateC_Standard_library --> stdlibh is the header of the general purpose standard library of C programming language TemplateC_Standard_library --> stringh is the header in the C standard library for the C programming language which contains h
  • time.h
  • wchar. TemplateC_Standard_library -->In the C and C++ programming languages time h
  • wctype. h

Contents

Design

The name and characteristic of each function are in a computer file called a header file but the actual implementation of functions are separated into a library file. In Computer programming, particularly in the C and C++ programming languages a header file or include file is a file, usually in In Computer science, a library is a collection of Subroutines used to develop Software. The naming and scope of headers have become common but the organization of libraries still remains diverse. The standard library is usually shipped along with a compiler. A compiler is a Computer program (or set of programs that translates text written in a computer language (the source language) into another Since C compilers often provide extra functionalities that are not specified in ANSI C, a standard library with a particular compiler is mostly incompatible with standard libraries of other compilers. ANSI C is the standard published by the American National Standards Institute (ANSI for the C programming language.

Design quality

Much of the C standard library has been shown to have been well-designed. A few parts, with the benefit of hindsight, are regarded as mistakes. The string input functions gets() (and the use of scanf() to read string input) are the source of many buffer overflows, and most programming guides recommend avoiding this usage. gets is a function in the C standard library, declared in the Header file Stdio scanf is a function that reads data with specified format from a given string stream source originated from C programming language, and is present in many other programming In Computer security and programming, a buffer overflow, or buffer overrun, is an anomalous condition where a process attempts to Another oddity is strtok(), a function that is designed as a primitive lexical analyser but is highly "fragile" and difficult to use. In Computer science, lexical analysis is the process of converting a sequence of characters into a sequence of tokens

History

The C programming language, before it was standardized, did not provide built-in functionalities such as I/O operations (unlike traditional languages such as Cobol and Fortran). tags please moot on the talk page first! --> In Computing, C is a general-purpose cross-platform block structured Fortran (previously FORTRAN) is a general-purpose, procedural, imperative Programming language that is especially suited to Over time, user communities of C shared ideas and implementations of what is now called C standard libraries to provide that functionality. Many of these ideas were incorporated eventually into the definition of the standardized C programming language.

Both Unix and C were created at AT&T's Bell Laboratories in the late 1960s and early 1970s. Unix (officially trademarked as UNIX, sometimes also written as Unix with Small caps) is a computer tags please moot on the talk page first! --> In Computing, C is a general-purpose cross-platform block structured Bell Laboratories (also known as Bell Labs and formerly known as AT&T Bell Laboratories and Bell Telephone Laboratories) is the Research organization During the 1970s the C programming language became increasingly popular. Many universities and organizations began creating their own variations of the language for their own projects. By the beginning of the 1980s compatibility problems between the various C implementations became apparent. In 1983 the American National Standards Institute (ANSI) formed a committee to establish a standard specification of C known as "ANSI C". Year 1983 ( MCMLXXXIII) was a Common year starting on Saturday (link displays the 1983 Gregorian calendar) This work culminated in the creation of the so-called C89 standard in 1989. Year 1989 ( MCMLXXXIX) was a Common year starting on Sunday (link displays 1989 Gregorian calendar) Part of the resulting standard was a set of software libraries called the ANSI C standard library. In Computer science, a library is a collection of Subroutines used to develop Software.

Later revisions of the C standard have added several new required header files to the library. Support for these new extensions varies between implementations.

The headers <iso646. h>, <wchar. h>, and <wctype. h> were added with Normative Addendum 1 (hereafter abbreviated as NA1), an addition to the C Standard ratified in 1995. Year 1995 ( MCMXCV) was a Common year starting on Sunday. Events of 1995

The headers <complex. h>, <fenv. h>, <inttypes. h>, <stdbool. h>, <stdint. h>, and <tgmath. h> were added with C99, a revision to the C Standard published in 1999. tags please moot on the talk page first! --> In Computing, C is a general-purpose cross-platform block structured Year 1999 ( MCMXCIX) was a Common year starting on Friday (link will display full 1999 Gregorian calendar)

ANSI Standard

The ANSI C standard library consists of 24 C header files which can be included into a programmer's project with a single directive. Each header file contains one or more function declarations, data type definitions and macros. The contents of these header files follows.

In comparison to some other languages (for example Java) the standard library is minuscule. The library provides a basic set of mathematical functions, string manipulation, type conversions, and file and console-based I/O. It does not include a standard set of "container types" like the C++ Standard Template Library, let alone the complete graphical user interface (GUI) toolkits, networking tools, and profusion of other functionality that Java provides as standard. C++ (" C Plus Plus " ˌsiːˌplʌsˈplʌs is a general-purpose Programming language. The Standard Template Library ( STL) is a software library partially included in the C++ Standard Library. The main advantage of the small standard library is that providing a working ANSI C environment is much easier than it is with other languages, and consequently porting C to a new platform is relatively easy.

Many other libraries have been developed to supply equivalent functionality to that provided by other languages in their standard library. For instance, the GNOME desktop environment project has developed the GTK+ graphics toolkit and GLib, a library of container data structures, and there are many other well-known examples. A gnome is a Mythical creature characterized by its extremely small size and subterranean lifestyle GTK+, or The GIMP Toolkit, is a Cross-platform Widget toolkit for creating Graphical user interfaces It is one of the most popular toolkits In Computing, GLib refers to a cross-platform software utility library. The variety of libraries available has meant that some superior toolkits have proven themselves through history. The considerable downside is that they often do not work particularly well together, programmers are often familiar with different sets of libraries, and a different set of them may be available on any particular platform.

ANSI C library header files

<assert.h>Contains the assert macro, used to assist with detecting logical errors and other types of bug in debugging versions of a program. asserth is a Header file in the standard library of the C programming language that defines the C preprocessor macro assert( In Computer programming, an assertion is a predicate (ie a true–false statement placed in a program to indicate that the developer thinks that the
<complex.h>A set of functions for manipulating complex numbers. complexh is a Header file in the standard library of the C programming language that defines functionality for Complex arithmetic. Complex plane In Mathematics, the complex numbers are an extension of the Real numbers obtained by adjoining an Imaginary unit, denoted (New with C99)
<ctype.h>Contains functions used to classify characters by their types or to convert between upper and lower case in a way that is independent of the used character set (typically ASCII or one of its extensions, although implementations utilizing EBCDIC are also known). TemplateC_Standard_library --> The header ctypeh in the ANSI C Standard Library for the C programming language A character encoding consists of a code that pairs a sequence of characters from a given character set (sometimes incorrectly referred to as Code page American Standard Code for Information Interchange ( ASCII) Extended Binary Coded Decimal Interchange Code ( EBCDIC) is an 8- Bit Character encoding ( Code page) used on IBM mainframe Operating
<errno.h>For testing error codes reported by library functions. TemplateC_Standard_library --> errnoh is a Header file in the standard library of C programming language.
<fenv. h>For controlling floating-point environment. In Computing, floating point describes a system for numerical representation in which a string of digits (or Bits represents a Real number. (New with C99)
<float.h>Contains defined constants specifying the implementation-specific properties of the floating-point library, such as the minimum difference between two different floating-point numbers (_EPSILON), the maximum number of digits of accuracy (_DIG) and the range of numbers which can be represented (_MIN, _MAX). TemplateC_Standard_library --> The header floath in the C Standard Library for the C programming language contains In Computing, floating point describes a system for numerical representation in which a string of digits (or Bits represents a Real number.
<inttypes.h>For precise conversion between integer types. The inttypesh file is a C header file that is part of the C standard library and API (New with C99)
<iso646.h>For programming in ISO 646 variant character sets. The iso646h header file is part of the C standard library. It was added to this library in a 1995 amendment to the C90 standard ISO 646 is an ISO standard that since 1972 has specified a 7- Bit character code from which several national standards are derived (New with NA1)
<limits.h>Contains defined constants specifying the implementation-specific properties of the integer types, such as the range of numbers which can be represented (_MIN, _MAX). TemplateC_Standard_library --> limitsh is the header of the general purpose standard library of the C programming language
<locale. h>For setlocale() and related constants. This is used to choose an appropriate locale. In Computing, locale is a set of Parameters that defines the user's language country and any special variant preferences that the user wants to see in their User
<math.h>For computing common mathematical functions
<setjmp.h>Declares the macros setjmp and longjmp, which are used for non-local exits
<signal.h>For controlling various exceptional conditions
<stdarg.h>For accessing a varying number of arguments passed to functions. TemplateC_Standard_library --> mathh is a header file in the standard library of C programming language designed for setjmph is a header defined in the C standard library to provide "non-local jumps" ( Control flow) outside of the normal function call and return TemplateC_Standard_library --> signalh is a Header file defined in the C Standard Library to specify how a program TemplateC_Standard_library --> is a header in the C standard library of the C programming language
<stdbool.h>For a boolean data type. TemplateC_Standard_library -->The header stdboolh in the C Standard Library for the C programming language contains (New with C99)
<stdint.h>For defining various integer types. stdinth is a Header file in the C standard library introduced in the C99 standard library section 7 (New with C99)
<stddef.h>For defining several useful types and macros. stddefh is a Header file in the Standard library of the C programming language which defines the Macro NULL and the types Ptrdiff_t
<stdio.h>Provides the core input and output capabilities of the C language. TemplateC_Standard_library --> stdioh, which stands for "standard input/output header" is the header in the This file includes the venerable printf function. The class of printf functions (which stands for " print f ormatted" is a class of functions, typically associated with Curly bracket programming
<stdlib.h>For performing a variety of operations, including conversion, pseudo-random numbers, memory allocation, process control, environment, signalling, searching, and sorting. TemplateC_Standard_library --> stdlibh is the header of the general purpose standard library of C programming language A pseudorandom number generator ( PRNG) is an Algorithm for generating a sequence of numbers that approximates the properties of random numbers
<string.h>For manipulating several kinds of strings. TemplateC_Standard_library --> stringh is the header in the C standard library for the C programming language which contains
<tgmath. h>For type-generic mathematical functions. (New with C99)
<time.h>For converting between various time and date formats. TemplateC_Standard_library -->In the C and C++ programming languages time
<wchar. h>For manipulating wide streams and several kinds of strings using wide characters - key to supporting a range of languages. (New with NA1)
<wctype. h>For classifying wide characters. (New with NA1)

The C standard library in other languages

Some languages include the functionality of the standard C library in their own libraries. The library may be adapted to better suit the language's structure, but the operation semantics are kept similar. The C++ programming language, for example, includes the functionality of the ANSI C standard library in the namespace std (like std::printf, std::atoi, std::feof, etc. C++ (" C Plus Plus " ˌsiːˌplʌsˈplʌs is a general-purpose Programming language. A namespace is an abstract container or environment created to hold a logical grouping of unique identifiers (i ), in header files with similar names to the C ones ("cstdio", "cmath", "cstdlib", etc). Other languages that take similar approaches are D and Python. The D programming language, also known simply as D, is an object-oriented, imperative, multiparadigm System programming language Python is a general-purpose High-level programming language. Its design philosophy emphasizes programmer productivity and code readability In the latter, for example, the built-in file object is defined as "implemented using C's stdio package"[1], so that the available operations (open, read, write, etc. ) are expected to have the same behavior as the corresponding C functions.

Common support libraries

While not standardized, C programs may depend on a runtime library of routines which contain code the compiler uses at runtime. The code that initializes the process for the operating system, for example, before calling main(), is implemented in the C Run-Time Library for a given vendor's compiler. The Run-Time Library code might help with other language feature implementations, like handling uncaught exceptions or implementing floating point code.

The C standard library only documents that the specific routines mentioned in this article are available, and how they behave. Because the compiler implementation might depend on these additional implementation-level functions to be available, it is likely the vendor-specific routines are packaged with the C Standard Library in the same module, because they're both likely to be needed by any program built with their toolset.

Though often confused with the C Standard Library because of this packaging, the C Runtime Library is not a standardized part of the language and is vendor-specific.

Compiler built-in functions

Some compilers (for example, GCC[1]) provide built-in versions of many of the functions in the C standard library; that is, the implementations of the functions are written into the compiled object file, and the program calls the built-in versions instead of the functions in the C library shared object file. The GNU Compiler Collection (usually shortened to GCC) is a set of Compilers produced for various Programming languages by the GNU Project In Computer science, object code, or an object file, is the representation of code that a Compiler or Assembler generates by processing In Computer science, a library is a collection of Subroutines used to develop Software. This reduces function call overhead, especially if function calls are replaced with inline variants, and allows other forms of optimisation (as the compiler knows the control-flow characteristics of the built-in variants), but may cause confusion when debugging (for example, the built-in versions cannot be replaced with instrumented variants). In Computer science, an inline function is a Programming language construct used to suggest to a Compiler that a particular function be subjected to Compiler optimization is the process of tuning the output of a Compiler to minimize or maximize some attribute of an Executable computer program In Computer science control flow (or alternatively flow of control refers to the order in which the individual statements, instructions or Function In context of Computer programming, instrumentation refers to an ability to monitor or measure the level of a product's performance to diagnose errors and writing trace information

POSIX standard library

Main article: C POSIX library

POSIX (and SUS) specifies a number of routines that should be available over and above those in the C standard library proper; these are often implemented alongside the C standard library functionality, with varying degrees of closeness. The C POSIX library is a language-independent library (using C Calling conventions that adds functions specific to POSIX systems POSIX (ˈpɒzɪks or "Portable Operating System Interface" is the collective name of a family of related standards specified by the IEEE to define The Single UNIX Specification ( SUS) is the collective name of a family of standards for Computer Operating systems to qualify for the name " Unix For example, glibc implements functions such as fork within libc. The GNU C Library, commonly known as glibc, is the C standard library released by the GNU Project. In Computing, when a process forks, it creates a copy of itself which is called a " child process. so, but before NPTL was merged into glibc it constituted a separate library with its own linker flag. The Native POSIX Thread Library ( NPTL) is a software feature that enables the Linux kernel to run programs written to use POSIX Threads fairly efficiently Often, this POSIX-specified functionality will be regarded as part of the library; the C library proper may be identified as the ANSI or ISO C library.

Implementations

See also

References

  1. ^ Other built-in functions provided by GCC, GCC Manual
  2. ^ Re: Does Newlib support mmu-less CPUs?

External links


This page aims to alphabetically list all the predefined functions used in the C standard library, and a few of the non-standard functions In C++, the Standard Library is a collection of classes and functions, which are written in the Core language.
© 2009 citizendia.org; parts available under the terms of GNU Free Documentation License, from http://en.wikipedia.org
Dapyx Software network: MP3 Explorer | Ebook Manager | Zenithic