C(7)
okay so bestie, welcome to the C(7) page from Miscellaneous Information Manual โ it's the whole C programming language lore drop, and we're doing it with sparkle. ๐
๐ธ NAME ๐ธ
c,c78,c89,c90,c95,c99,c11,c17,c23,c2yโ The C programming language โจ
โจ DESCRIPTION โจ
C is a general purpose programming language, and it has a strong connection with the UNIX operating system and its derivatives, because the vast majority of those systems were written in C. ๐ซถ
The C language contains some basic ideas from the BCPL language through the B language written by Ken Thompson in 1970 for the DEC PDP-7 machines. The development of the UNIX operating system was started on a PDP-7 machine in assembly language, but that made it very difficult to port the existing code to other systems. ๐ญ
In 1972 Dennis M. Ritchie worked out the C programming language for further development of the UNIX operating system. The idea was to implement only the C compiler for different platforms, and implement most part of the operating system in the new programming language to simplify the portability between different architectures. So yeah: C is very eligible for (but not limited to) writing operating systems and low-level applications. ๐
The C language did not have a specification or standardized version for a long time. It went through a lot of changes and improvements for literal ages. In 1978, Brian W. Kernighan and Dennis M. Ritchie published the first book about C under the title "The C Programming Language". We can think of this book as the first specification of the language. This version is often referred as K&R C after the names of the authors. Sometimes it is referred as C78, as well, after the publishing year of the first edition of the book. ๐
It is important to notice, that the instruction set of the language is limited to the most fundamental elements for simplicity. Handling of the standard I/O and such common functions are implemented in the libraries shipped with the compiler. As these functions are also widely used, it was demanded to include into the description what requisites the library should conform to, not just strictly the language itself. Accordingly, the aforementioned standards cover the library elements, as well. The elements of this standard library is still not enough for more complicated tasks. In this case the provided system calls of the given operating system can be used. To not lose the portability by using these system calls, the POSIX (Portable Operating System Interface) standard evolved. It describes what functions should be available to keep portability. Note, that POSIX is not a C standard, but an operating system standard and thus is beyond the scope of this manual. The standards discussed below are all C standards and only cover the C programming language and the accompanying library. All listed improvements for each standard edition are taken from the official standard drafts. For further details, check the publicly available drafts or purchase the published standards โ from either ISO or IEC resources. ๐ง
After the publication of the book mentioned before, the American National Standards Institute (ANSI) started to work on standardizing the language, and they announced ANSI X3.159-1989 in 1989. It is usually referred to as ANSI C or C89. The main difference in this standard were the function prototypes, which is a new way of declaring functions. With the old-style function declarations, the compiler was unable to check the sanity of the actual parameters at a function call. The old syntax was highly error-prone because incompatible parameters were hard to detect in the program code and the problem only showed up at run-time. ๐
In 1990, the International Organization for Standardization (ISO) adopted the ANSI standard as ISO/IEC 9899:1990 in 1990. This is also referred to as ISO C or C90. It only contains negligible minor modifications against ANSI C, so the two standards often considered to be fully equivalent. This was a very important milestone in the history of the C language, but the development of the language did not stop. iconic behavior, honestly ๐
The ISO C standard was later extended with an amendment as ISO/IEC 9899/AMD1 in 1995. This contained, for example, the wide-character support in <wchar.h> and <wctype.h>, and also restricted character set support via diagraphs and <iso646.h>. This amendment is usually referred to as C95. Two technical corrigenda were also published: Technical Corrigendum 1 as ISO/IEC 9899/COR1 in 1994 and Technical Corrigendum 2 as ISO/IEC 9899/COR2 in 1996. The continuous development and growth made it necessary to work out a new standard, which contains the new features and fixes the known defects and deficiencies of the language. ๐ ๏ธ
As a result, ISO/IEC 9899:1999 was born in 1999 as the second edition of the standard. Similarly to the other standards, this is informally named after the publication year as C99. The improvements include (but are not limited to) the following:
- โจ digraphs, trigraphs, and alternative spellings for the operators that use non-ISO646 characters in
<iso646.h> - ๐ extended multibyte and wide character library support in
<wchar.h>and<wctype.h> - ๐ variable length arrays
- ๐งฉ flexible array members
- ๐ข complex (and imaginary) number arithmetic support in
<complex.h> - ๐งฎ type-generic math macros in
<tgmath.h> - ๐ฆ the
long long inttype and library functions - ๐ซ remove implicit
inttype - ๐ universal character names (
\uand\U) - ๐งฑ compound literals
- ๐ซ remove implicit function declaration
- ๐ฌ BCPL style single-line comments
- ๐ allow mixed declarations and code
- ๐ฅ the
vscanf()family of functions in<stdio.h>and<wchar.h> - โ allow trailing comma in enum declaration
- โก inline functions
- ๐ค the
snprintf()family of functions in<stdio.h> - ๐ boolean type and macros in
<stdbool.h> - ๐ซ empty macro arguments
- ๐ช
_Pragmapreprocessing operator - ๐ท๏ธ
__func__predefined identifier - ๐
va_copymacro in<stdarg.h> - ๐ฐ๏ธ additional
strftimeconversion specifiers
Later in 2011, the third edition of the standard, ISO/IEC 1989:2011, commonly referred to as C11 (formerly C1x), came out and replaced the second edition by ISO/IEC 9899:1999/COR1:2001, ISO/IEC 9899:1999/COR2:2004, and ISO/IEC 9899:1999/COR3:2007. The improvements include (but are not limited to) the following:
- ๐งต support for multiple threads of execution and atomic operations in
<threads.h>and<stdatomic.h> - ๐ additional floating-point characteristic macros in
<float.h> - ๐ querying and specifying alignment of objects in
<stdalign.h>and<stdlib.h> - ๐ถ Unicode character types and functions in
<uchar.h> - ๐งฌ type-generic expressions
- ๐ก๏ธ static assertions in
<assert.h> - ๐ซฅ anonymous structures and unions
- ๐ซ remove the
getsfunction from<stdio.h> - ๐งฐ add the
aligned_alloc,at_quick_exit, andquick_exitfunctions in<stdlib.h>
C11 was later superseded by ISO/IEC 9899:2018, also known as C17, which was prepared in 2017 and published in June 2018 as the fourth edition. It incorporates the Technical Corrigendum 1 (ISO/IEC 9899:2011/COR1:2012) which was published in 2012. It addressed defects and deficiencies in C11 without introducing new features, only corrections and clarifications. ๐งผโจ
C23, formally ISO/IEC 9899:2024, is the current standard with significant updates that supersede C17 (ISO/IEC 9899:2018). The standardization effort began in 2016, informally as C2x, with the first WG14 meeting in 2019, and was officially published on October 31, 2024. C23 was originally anticipated for an earlier release, but the timeline was extended due to COVID-19 pandemic. With C23, the value of __STDC_VERSION__ has been updated from 201710L to 202311L. Key changes include (but are not limited to) the following:
- ๐ซฅ Add null pointer type
nullptr_tand thenullptrkeyword - ๐ง Add
constexprkeyword as a storage-class specifier for objects - ๐ Redefine the usage of the
autokeyword to support type inference while also retaining its previous functionality as a storage-class specifier when used with a type - ๐ข Add
%bbinary conversion specifier to theprintf()andscanf()function families - ๐งฎ Add binary conversion support (
0band0B) to thestrtol()andwcstol()function families - ๐ฆ Add the
#embeddirective for binary resource inclusion and__has_embedto check resource availability with preprocessor directives - โ ๏ธ Add the
#warningdirective for diagnostics - ๐ชข Add the
#elifdefand#elifndefdirectives - ๐ค Add the
u8prefix for character literals to represent UTF-8 encoding, compatible with C++17 - ๐งต Add the
char8_ttype for UTF-8 encoded data and update the types ofu8character constants and string literals tochar8_t - ๐ Add functions
mbrtoc8()andc8rtomb()to convert between narrow multibyte characters and UTF-8 encoding - ๐งฌ Define all
char16_tstrings and literals as UTF-16 encoded andchar32_tstrings and literals as UTF-32 encoded unless specified otherwise - ๐งฑ Allow storage-class specifiers within compound literals
- ๐งฎ Support the latest IEEE 754 standard,
ISO/IEC 60559:2020, with binary and (optional) decimal floating-point arithmetic - ๐ก๏ธ Add single-argument
_Static_assertfor compatibility with C++17 - ๐ Add
_Decimal32,_Decimal64,_Decimal128keywords for (optional) decimal floating-point arithmetic - โ๏ธ Add digit separator
'(the single quote character) for literals - ๐ท๏ธ Enable specification of the underlying type of an
enum - ๐ช Standardize the
typeof()operator - ๐งผ Add
memset_explicit()in<string.h>to securely erase sensitive data regardless of optimizations - ๐งต Add
memccpy()in<string.h>for efficient string concatenation - ๐ Add
memalignment()in<stdlib.h>to determine pointer alignment - ๐ Add
strdup()andstrndup()in<string.h>to allocate string copies - ๐งฐ Introduce bit utility functions, macros, and types in the new header
<stdbit.h> - ๐ฐ๏ธ Add
timegm()in<time.h>for converting time structures to calendar time values - ๐ Add
__has_includefor header availability checking via preprocessor directives __has_c_attributeโ a new way to check whether an attribute even exists, straight from preprocessor directives ๐_BitInt(N)andunsigned _BitInt(N)โ bit-precise integers, literally exactly N bits, no more no less โจ andBITINT_MAXWIDTHtells you the max bit width you can ask fortrueandfalsegot PROMOTED ๐ they're proper keywords now (they used to be macros from<stdbool.h>, rip to that era)- new keywords:
alignas,alignof,bool,static_assert,thread_localโ and the previously defined keywords are still available as alternative spellings, so nothing breaks, we love a graceful glow-up ๐ซถ - zero initialization with
{}is enabled now (and yes, that includes initialization of VLAs) ๐ - C++11 style attributes via
[[]]are here!! introducing[[deprecated]],[[fallthrough]],[[maybe_unused]],[[nodiscard]], and[[noreturn]]โญ _Noreturn,noreturn, and the header<stdnoreturn.h>features from C11 are officially deprecated ๐ (they ate, but their time is up)- trigraph support: REMOVED ๐๏ธ
- K&R function definitions and declarations: REMOVED ๐๏ธ
- non-two's-complement representations for signed integers: REMOVED ๐๏ธ
okay so what's NEXT ๐
The next version of the C Standard, informally named C2y, is anticipated to release within the next six years, targeting 2030 at the latest ๐
A charter for C2y is still being drafted and discussed, with several papers under debate from the January 2024 meeting in Strasbourg, France โ and those papers are lowkey indicating that this new version may address long-standing requests and deficiencies noted by the C community, while preserving its core strengths ๐ง (like, character development but make it a language standard)
The ISO/IEC JTC1/SC22/WG14 committee is the one responsible for the ISO/IEC 9899, C Standard ๐ซก that's the group chat running the whole thing.
๐ SEE ALSO
๐ STANDARDS
The receipts, bestie โ every single one of them, in order ๐
- ANSI, X3.159-1989 (aka C89 or ANSI C).
- ISO/IEC, 9899:1990 (aka C90).
- ISO/IEC, 9899:1990/AMD 1:1995, Amendment 1: C Integrity (aka C95).
- ISO/IEC, 9899:1990/COR 1:1994, Technical Corrigendum 1.
- ISO/IEC, 9899:1990/COR 2:1996, Technical Corrigendum 2.
- ISO/IEC, 9899:1999 (aka C99).
- ISO/IEC, 9899:1999/COR 1:2001, Technical Corrigendum 1.
- ISO/IEC, 9899:1999/COR 2:2004, Technical Corrigendum 2.
- ISO/IEC, 9899:1999/COR 3:2007, Technical Corrigendum 3.
- ISO/IEC, TR 24731-1:2007 (aka bounds-checking interfaces).
- ISO/IEC, TS 18037:2008 (aka, embedded C).
- ISO/IEC, TR 24747:2009 (aka mathematical special functions).
- ISO/IEC, TR 24732:2009 (aka decimal floating-point).
- ISO/IEC, TR 24731-2:2010 (aka dynamic allocation functions).
- ISO/IEC, 9899:2011 (aka C11).
- ISO/IEC, 9899:2011/COR 1:2012, Technical Corrigendum 1.
- ISO/IEC, TS 17961:2013 (aka C secure coding rules).
- ISO/IEC, TS 18861-1:2014 (aka binary floating-point).
- ISO/IEC, TS 18861-2:2015 (aka decimal floating-point).
- ISO/IEC, TS 18861-3:2015 (aka interchange and extended types).
- ISO/IEC, TS 18861-4:2015 (aka supplementary functions).
- ISO/IEC, TS 17961:2013/COR 1:2016 (aka C secure coding rules TC1).
- ISO/IEC, TS 18861-5:2016 (aka supplementary attributes).
- ISO/IEC, 9899:2018 (aka C17).
- ISO/IEC, 9899:2024 (aka C23).
no cap, that's the entire lineage laid out like a family tree and honestly it's giving ancestry.com ๐ฆ
๐ฐ๏ธ HISTORY
This manual page first appeared in FreeBSD 9.0 โ a real founding-era moment, we stan an origin story ๐
๐ AUTHORS
This manual page was originally written by Gabor Kovesdan <gabor@FreeBSD.org>. It was updated by Faraz Vahedi <kfv@kfv.io> with information about more recent C standards โ ty for your service besties ๐ซถโจ
and that's a wrap, babe ๐ this edition of the page is tagged Debian, dated November 4, 2024, and files itself under C(7) โ go forth and write some beautiful, standards-compliant C, you absolute icon ๐
๐
๐ฆ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (C) 2007, 2010 Gabor Kovesdan. All rights reserved
- Copyright (C) 2021 Faraz Vahedi <kfv@kfv.io>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms