Английская Википедия:C23 (C standard revision)

Материал из Онлайн справочника
Перейти к навигацииПерейти к поиску

Шаблон:Short description Шаблон:C language revisions

C23 is the informal name for what will likely become ISO/IEC 9899:2024, the next standard for the C programming language, which will replace C17 (standard ISO/IEC 9899:2018).[1] It was started in 2016 informally as C2x,[2] and expected to be published in 2024.[3] The most recent publicly available working draft of C23 was released on April 1, 2023.[4] The first WG14 meeting for the C2x draft was held in October 2019,[5] virtual remote meetings were held in 2020 due to the COVID-19 pandemic, then various teleconference meetings continued to occur through 2024.

Features

Changes integrated into the latest working draft of C23 are listed below.[4]

Standard Library

New functions

  • Add memset_explicit() function in <string.h> to erase sensitive data, where memory store must always be performed regardless of optimizations.[6]
  • Add memccpy() function in <string.h> to efficiently concatenate strings – similar to POSIX and SVID C extensions.[7]
  • Add strdup() and strndup() functions in <string.h> to allocate a copy of a string – similar to POSIX and SVID C extensions.[8]
  • Add memalignment() function in <stdlib.h> to determine the byte alignment of a pointer.[9]
  • Add bit utility functions / macros / types in new header <stdbit.h> to examine many integer types. All start with stdc_ to minimize conflict with legacy code and 3rd party libraries.[10]
    • In the following, replace * with uc, us, ui, ul, ull for five function names, or blank for a type-generic macro.[10]
    • Add stdc_count_ones*() and stdc_count_zeros*() to count number of 1 or 0 bits in value.[10]
    • Add stdc_leading_ones*() and stdc_leading_zeros*() to count leading 1 or 0 bits in value.[10]
    • Add stdc_trailing_ones*() and stdc_trailing_zeros*() to count trailing 1 or 0 bits in value.[10]
    • Add stdc_first_leading_one*() and stdc_first_leading_zero*() to find first leading bit with 1 or 0 in value.[10]
    • Add stdc_first_trailing_one*() and stdc_first_trailing_zero*() to find first trailing bit with 1 or 0 in value.[10]
    • Add stdc_has_single_bit*() to determine if value is an exact power of 2 (return true if and only if there is a single 1 bit).[10]
    • Add stdc_bit_floor*() to determine the largest integral power of 2 that is not greater than value.[10]
    • Add stdc_bit_ceil*() to determine the smallest integral power of 2 that is not less than value.[10]
    • Add stdc_bit_width*() to determine number of bits to represent a value.[10]
  • Add timegm() function in <time.h> to convert time structure into calendar time value - similar to function in glibc and musl libraries.[11]

Existing functions

  • Add %b binary conversion specifier to printf() function family, prepending non-zero values with 0b, similar to how %x works. Implementations that previously did not use %B as their own extension are encouraged to implement and prepend non-zero values with 0B, similar to how %X works.[12]
  • Add %b binary conversion specifier to scanf() function family.[12]
  • Add 0b and 0B binary conversion support to strtol() and wcstol() function families.[12]
  • Make the functions bsearch(), bsearch_s(), memchr(), strchr(), strpbrk(), strrchr(), strstr(), and their wide counterparts wmemchr(), wcschr(), wcspbrk(), wcsrchr(), wcsstr() return a const qualified object if one was passed to them.[13]

Preprocessor

Types

Constants

Keywords

Syntax

C++ compatibility

Other features

  • Support for the ISO/IEC 60559:2020, the current version of the IEEE 754 standard for floating-point arithmetic, with extended binary floating-point arithmetic and (optional) decimal floating-point arithmetic.[53][54]

Obsolete features

Some old obsolete features are either removed or deprecated from the working draft of C23:

  • Remove Trigraphs.[59]
  • Remove K&R function definitions/declarations (with no information about the function arguments).[60][61]
  • Remove representations for signed integers other than two's complement. Two's complement signed integer representation will be required.[62]
  • The Шаблон:C-lang macros in <float.h> are obsolescent features.[63]

Compiler support

The GCC 9,[64] Clang 9.0,[65] and Pelles C 11.00[66] compilers implement an experimental compiler flag to support this standard.

See also

Шаблон:Portal

References

Шаблон:Reflist

External links

Шаблон:S-start Шаблон:S-bef Шаблон:S-ttl Шаблон:S-non Шаблон:End

Шаблон:C programming language

  1. Шаблон:Cite web
  2. Шаблон:Cite web
  3. Шаблон:Cite web
  4. 4,0 4,1 Шаблон:Cite web
  5. Шаблон:Cite web
  6. Шаблон:Cite web
  7. Шаблон:Cite web
  8. Шаблон:Cite web
  9. Шаблон:Cite web
  10. 10,00 10,01 10,02 10,03 10,04 10,05 10,06 10,07 10,08 10,09 10,10 Шаблон:Cite web
  11. Шаблон:Cite web
  12. 12,0 12,1 12,2 Шаблон:Cite web
  13. Шаблон:Cite web
  14. 14,0 14,1 Шаблон:Cite web
  15. Шаблон:Cite web
  16. Шаблон:Cite web
  17. Шаблон:Cite web
  18. Шаблон:Cite web
  19. Шаблон:Cite web
  20. Шаблон:Cite web
  21. 21,0 21,1 Шаблон:Cite web
  22. Шаблон:Cite web
  23. Шаблон:Cite web
  24. Шаблон:Cite web
  25. Шаблон:Cite web
  26. Шаблон:Cite web
  27. Шаблон:Cite web
  28. Шаблон:Cite web
  29. Шаблон:Cite web
  30. Шаблон:Cite web
  31. Шаблон:Cite web
  32. Шаблон:Cite web
  33. Шаблон:Cite web
  34. Шаблон:Cite web
  35. Шаблон:Cite web
  36. Шаблон:Cite web
  37. Шаблон:Cite web
  38. Шаблон:Cite web
  39. Шаблон:Cite web
  40. Шаблон:Cite web
  41. Шаблон:Cite web
  42. Шаблон:Cite web
  43. Шаблон:Cite web
  44. Шаблон:Cite web
  45. Шаблон:Cite web
  46. Шаблон:Cite web
  47. Шаблон:Cite web
  48. Шаблон:Cite web
  49. Шаблон:Cite web
  50. Шаблон:Cite web
  51. Шаблон:Cite web
  52. What is the point of the UTF-8 character literals proposed for C++17?; Stack Overflow.
  53. Шаблон:Cite web
  54. Шаблон:Cite web
  55. Шаблон:Cite web
  56. Шаблон:Cite web
  57. Шаблон:Cite web
  58. Шаблон:Cite web
  59. Шаблон:Cite web
  60. Шаблон:Cite web
  61. Шаблон:Cite web
  62. Шаблон:Cite web
  63. Шаблон:Cite web
  64. Шаблон:Cite web
  65. Шаблон:Cite web
  66. Шаблон:Cite web