C standard library

[2] Starting from the original ANSI C standard, it was developed at the same time as the C POSIX library, which is a superset of it.

[5] The C standard library provides macros, type definitions and functions for tasks such as string manipulation, mathematical computation, input/output processing, memory management, and input/output.

The application programming interface (API) of the C standard library is declared in a number of header files.

After a long period of stability, three new header files (iso646.h, wchar.h, and wctype.h) were added with Normative Addendum 1 (NA1), an addition to the C Standard ratified in 1995.

On Unix-like systems, the authoritative documentation of the API is provided in the form of man pages.

The C library functions, including the ISO C standard ones, are widely used by programs, and are regarded as if they were not only an implementation of something in the C language, but also de facto part of the operating system interface.

Under FreeBSD[9] and glibc,[10] some functions such as sin() are not linked in by default and are instead bundled in the mathematical library libm.

[11] musl satisfies this requirement by putting everything into a single libc library and providing an empty libm.

Some functions in the C standard library have been notorious for having buffer overflow vulnerabilities and generally encouraging buggy programming ever since their adoption.

Despite concerns, TR 24731-1 was integrated into the C standards track in ISO/IEC 9899:2011 (C11), Annex K (Bounds-checking interfaces), and implemented approximately in Microsoft’s C/++ runtime (CRT) library for the Win32 and Win64 platforms.

(By default, Microsoft Visual Studio’s C and C++ compilers issue warnings when using older, "insecure" functions.

According to the Linux manual page math_error, "The current (version 2.8) situation under glibc is messy.

[citation needed] Over time, user communities of C shared ideas and implementations of what is now called C standard libraries.

The POSIX specification includes header files for, among other uses, multi-threading, networking, and regular expressions.

The C++ language incorporates the majority of the C standard library’s constructs into its own, excluding C-specific machinery.

Other languages take a similar approach, placing C compatibility functions/routines under a common namespace; these include D, Perl, and Ruby.

[47] More generally, Python 2.x specifies the built-in file objects as being “implemented using C's stdio package,"[48] and frequent reference is made to C standard library behaviors; the available operations (open, read, write , etc.)

Rust offers crate libc, which allows various C standard (and other) library functions and type definitions to be used.

The C library provides a basic set of mathematical functions, string manipulation, type conversions, and file and console-based I/O.

The main advantage of the small standard library is that providing a working ISO C environment is much easier than it is with other languages, and consequently porting C to a new platform is comparatively easy.