[go: nahoru, domu]

Jump to content

C23 (C standard revision): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Revision navigation
Added dates for a couple of references
Line 2: Line 2:
{{C language revisions}}
{{C language revisions}}


'''C2x''' is an informal name for the next (after [[C18 (C standard revision)|C18]]) major [[C language]] standard revision.<ref name="cpp">{{cite web |title=History of C |url=https://en.cppreference.com/w/c/language/history |website=cppreference}}</ref> It is not expected to be voted on until 2021.<ref name="phoronix">{{cite web|last1=Michael Larabel|title=GCC 9 Compiler Adds -std=c2x And -std=gnu2x For Future C Language Update|url=https://www.phoronix.com/scan.php?page=news_item&px=GCC-C2X-C-Standard}}</ref>
'''C2x''' is an informal name for the next (after [[C18 (C standard revision)|C18]]) major [[C language]] standard revision.<ref name="cpp">{{cite web |title=History of C |url=https://en.cppreference.com/w/c/language/history |website=cppreference}}</ref> It is not expected to be voted on until 2021.<ref name="phoronix">{{cite web|last1=Michael Larabel|title=GCC 9 Compiler Adds -std=c2x And -std=gnu2x For Future C Language Update|date=2018-10-18|url=https://www.phoronix.com/scan.php?page=news_item&px=GCC-C2X-C-Standard}}</ref>


==Features==
==Features==
Among proposed features:
Among proposed features:
* single-argument [[Assert.h#Static Assert|_Static_assert]]
* single-argument [[Assert.h#Static Assert|_Static_assert]]
* C++11 style [[C++11#Attributes|attribute]] syntax<ref name="phoronix-clang">{{cite web|last1=Michael Larabel|title=LLVM Clang 9.0 Picks Up Initial C2x Language Mode|url=https://www.phoronix.com/scan.php?page=news_item&px=LLVM-Clang-9-C2x}}</ref>
* C++11 style [[C++11#Attributes|attribute]] syntax<ref name="phoronix-clang">{{cite web|last1=Michael Larabel|title=LLVM Clang 9.0 Picks Up Initial C2x Language Mode|date=2019-05-14|url=https://www.phoronix.com/scan.php?page=news_item&px=LLVM-Clang-9-C2x}}</ref>
* extended binary floating-point arithmetic, decimal floating-point arithmetic
* extended binary floating-point arithmetic, decimal floating-point arithmetic
* <code>memccpy()</code>, <code>strdup()</code>, <code>strndup()</code> - similar to functions found in the [[POSIX]] and [[System V Interface Definition|SVID]] C extensions
* <code>memccpy()</code>, <code>strdup()</code>, <code>strndup()</code> - similar to functions found in the [[POSIX]] and [[System V Interface Definition|SVID]] C extensions

Revision as of 06:36, 14 September 2020

C2x is an informal name for the next (after C18) major C language standard revision.[1] It is not expected to be voted on until 2021.[2]

Features

Among proposed features:

  • single-argument _Static_assert
  • C++11 style attribute syntax[3]
  • extended binary floating-point arithmetic, decimal floating-point arithmetic
  • memccpy(), strdup(), strndup() - similar to functions found in the POSIX and SVID C extensions
  • char8_t type, in the same vein as char16_t and char32_t added in C11 (proposal N2231).

It adds a new principle to the "Original Principles" of C:

15. Application Programming Interfaces (APIs) should be self-documenting when possible. In particular, the order of parameters in function declarations should be arranged such that the size of an array appears before the array. The purpose is to allow Variable-Length Array (VLA) notation to be used. This not only makes the code's purpose clearer to human readers, but also makes static analysis easier. Any new APIs added to the Standard should take this into consideration.[4]

Support

The GCC 9[2] and Clang 9.0[3] compilers support the -std=c2x option to support this standard.

References

  1. ^ "History of C". cppreference.
  2. ^ a b Michael Larabel (2018-10-18). "GCC 9 Compiler Adds -std=c2x And -std=gnu2x For Future C Language Update".
  3. ^ a b Michael Larabel (2019-05-14). "LLVM Clang 9.0 Picks Up Initial C2x Language Mode".
  4. ^ "WG 14 N 2086 -- C2x Charter". www.open-std.org.

External links

Preceded by C language standards Latest