C23 (C 표준 개정판)
C23 (C standard revision)C언어 개정판 |
---|
C23은 C17(표준 ISO/IEC 9899:2018)을 대체할 C 프로그래밍 언어의 다음 표준인 ISO/IEC 9899:2024의 비공식 이름입니다.[1] 2016년 C2x로 비공식적으로 시작되었으며,[2] 2024년에 출판될 예정입니다.[3] C23의 가장 최근 공개된 작업 초안은 2023년 4월 1일에 공개되었습니다.[4] 2019년 10월 C2x 초안을 위한 최초의 WG14 회의가 개최되었고,[5] 2020년 코로나19 팬데믹으로 인해 가상 원격 회의가 개최된 후 2024년까지 다양한 원격 회의가 지속적으로 발생하였습니다.
특징들
C23의 최신 작업 초안에 통합된 변경 사항은 아래에 나열되어 있습니다.[4]
표준 라이브러리
신기능
- 더하다
memset_explicit()
에 종사하는.<string.h>
민감한 데이터를 지우려면 최적화 여부에 관계없이 항상 메모리 저장을 수행해야 합니다.[6] - 더하다
memccpy()
에 종사하는.<string.h>
POSIX 및 SVIDC 확장과 유사하게 문자열을 효율적으로 연결합니다.[7] - 더하다
strdup()
그리고.strndup()
에 있어서의 기능.<string.h>
POSIX 및 SVIDC 확장과 유사한 문자열 복사본을 할당합니다.[8] - 더하다
memalignment()
에 종사하는.<stdlib.h>
포인터의 바이트 정렬을 결정합니다.[9] - 새 헤더에 비트 유틸리티 기능 / 매크로 / 유형 추가
<stdbit.h>
다양한 정수 유형을 조사합니다. 모든 것이 시작됩니다.stdc_
레거시 코드 및 타사 라이브러리와의 충돌을 최소화합니다.[10]- 다음에서 교체합니다.
*
와 함께uc
,us
,ui
,ul
,ull
5개 함수 이름의 경우 또는 유형 generic 매크로의 경우 공백입니다. - 더하다
stdc_count_ones*()
그리고.stdc_count_zeros*()
값으로 1비트 또는 0비트의 수를 세는 것입니다.[10] - 더하다
stdc_leading_ones*()
그리고.stdc_leading_zeros*()
선행 1비트 또는 0비트 값을 계산합니다.[10] - 더하다
stdc_trailing_ones*()
그리고.stdc_trailing_zeros*()
값이 1비트 또는 0비트인 경우를 세는 것입니다.[10] - 더하다
stdc_first_leading_one*()
그리고.stdc_first_leading_zero*()
값이 1 또는 0인 첫 번째 선행 비트를 찾습니다.[10] - 더하다
stdc_first_trailing_one*()
그리고.stdc_first_trailing_zero*()
값이 1 또는 0인 첫 번째 후행 비트를 찾습니다.[10] - 더하다
stdc_has_single_bit*()
값이 2의 정확한 거듭제곱인지 확인합니다(단일 1비트인 경우에만 true를 반환합니다).[10] - 더하다
stdc_bit_floor*()
값보다 크지 않은 2의 최대 적분 거듭제곱을 결정합니다.[10] - 더하다
stdc_bit_ceil*()
값보다 작지 않은 2의 최소 적분 거듭제곱을 결정합니다.[10] - 더하다
stdc_bit_width*()
값을 나타내는 비트 수를 결정합니다.[10]
- 다음에서 교체합니다.
- 더하다
timegm()
에 종사하는.<time.h>
glibc 및 musl 라이브러리의 함수와 유사하게 시간 구조를 캘린더 시간 값으로 변환합니다.[11]
기존기능
- 더하다
%b
이진 변환 지정자:printf()
함수 패밀리, 0이 아닌 값 앞에 추가0b
, 와 비슷한%x
작동하다. 이전에 사용하지 않았던 구현%B
0이 아닌 값을 구현하고 선행하는 자체 확장이 권장됨에 따라0B
, 와 비슷한%X
작품[12] - 더하다
%b
이진 변환 지정자:scanf()
함수족[12] - 더하다
0b
그리고.0B
이진 변환 지원 대상strtol()
그리고.wcstol()
직능 [12]가족 - 함수를 만듭니다.
bsearch()
,bsearch_s()
,memchr()
,strchr()
,strpbrk()
,strrchr()
,strstr()
, 그리고 그들의 광범위한 대응물들.wmemchr()
,wcschr()
,wcspbrk()
,wcsrchr()
,wcsstr()
한정된 개체를 반환할 경우 반환합니다.[13]
전처리기
- 더하다
#elifdef
그리고.#elifndef
본질적으로 동등한 지시.[14]#elif defined
그리고.#elif !defined
. 두 지침 모두 C++23 표준과 GCC 12에 추가되었습니다.[15] - 더하다
#embed
이진 리소스 포함에 대한 지침 및__has_embed
사전 프로세서 지침에 의해 리소스의 가용성을 확인할 수 있도록 허용합니다.[16] - 더하다
#warning
진단에 대한 지침입니다.[17] - 더하다
__has_include
헤더의 가용성을 전처리기 지침에 의해 확인할 수 있도록 허용합니다.[18] - 더하다
__has_c_attribute
속성의 가용성을 전처리기 지침에서 확인할 수 있도록 허용합니다.[19] (새로운 속성 기능은 "C++ 호환성" 그룹 참조) - 더하다
__VA_OPT__
가변 인수가 포함 매크로로 전달된 경우에만 인수로 확장되는 가변 매크로에 대한 함수 매크로입니다.[20]
종류들
- 추가, null 포인터 유형입니다.[21]
- 더하다
_BitInt(N)
그리고.unsigned _BitInt(N)
비트 precise 정수에 대한 유형입니다. 더하다BITINT_MAXWIDTH
최대 비트 너비를 위한 매크로입니다.[22][23] - 더하다
ckd_add()
,ckd_sub()
,ckd_mul()
확인된 정수 연산에 대한 매크로입니다.[24] - 변수 수정 유형(스택에 할당된 자동 변수인 VLA는 제외)은 필수 기능이 됩니다.[25]
- 더 나은 사용 지원
const
배열로.[26] - 의 표준화
typeof(...)
오퍼레이터[27] - 그 의미는.
auto
키워드는 유형 추론을 유발하는 동시에 유형과 함께 사용되는 경우 스토리지 클래스 지정자의 이전 의미를 유지하도록 변경되었습니다. C++와 달리 C23은 개체 정의에 대해서만 유형 추론을 허용합니다(추론 함수 반환 유형 또는 함수 매개 변수 유형 없음).[28] - 구조, 결합 및 열거된 유형에 대한 호환성 규칙이 변경되어 동일한 태그를 가진 호환성 유형을 다시 선언할 수 있게 되었습니다.[29]
상수
- 다음에 대한 상수 추가
nullptr_t
활자를 [21]치다 - 더하다
wb
그리고.uwb
의 정수 리터럴 접미사_BitInt(N)
그리고.unsigned _BitInt(N)
등의 [30]유형6uwb
을 산출해 내다unsigned _BitInt(3)
,그리고.-6wb
을 산출해 내다signed _BitInt(4)
3개의 값 비트와 1개의 부호 비트를 가지고 있습니다. - 더하다
0b
그리고.0B
이진 리터럴 상수 접두사([31]예:0b10101010
(0xAA에 해당). - 더하다
'
문자 상수에 대한 자릿수 구분자([32]예:0xFE'DC'BA'98
(equating to 0xFEDCBA98),299'792'458
(299792458과 동일),1.414'213'562
(equating to 1.414213562). - 의 기본 유형을 지정하는 기능을 추가합니다.
enum
.[33] - 허락하다
enum
다음으로 표현할 수 없는 값을 저장할 고정된 기본 유형이 없는 sint
.[34]
키워드
- 더하다
true
그리고.false
키워드.[35] - 더하다
alignas
,alignof
,bool
,static_assert
,thread_local
키워드thread_local
. 이전에 정의된 키워드가 대체 철자가 됩니다._Alignas
,_Alignof
,_Bool
,_Static_assert
,_Thread_local
.[36] - 더하다
_BitInt
키워드("유형" 그룹 참조) - 더하다
typeof
그리고.typeof_unqual
키워드("유형" 그룹 참조) - 더하다
nullptr
키워드("constants" 그룹 참조) - 더하다
constexpr
키워드("기타" 그룹 참조) - 더하다
_Decimal32
,_Decimal64
,_Decimal128
(선택사항) 소수 부동 소수점 산술에 대한 키워드("기타" 그룹 참조)
구문
- 레이블은 선언문 앞과 복합문 끝에 나타날 수 있습니다.[37]
- 함수 정의의 이름이 지정되지 않은 매개 변수입니다.[38]
- 제로 초기화(0)
{}
(VLA 초기화 포함).[39] - 변증법 함수는 더 이상 타원 및 다음 앞에 명명된 인수를 필요로 하지 않습니다.
va_start
매크로는 더 이상 두 번째 인수를 필요로 하지 않으며 첫 번째 인수 이후에 있는 인수를 평가하지도 않습니다.[40] - 이중 대괄호를 사용하여 C++11 스타일 특성 구문[41] 추가
[[]]
. - 단일 인수 추가
_Static_assert
C++17과의 호환성을 위해.[42] - 프로토타입에 나열된 인수가 없는 함수
void foo()
인수를 사용하지 않는 것으로 이해됩니다(K&R 함수 선언 제거 참조).
C++ 호환성
- 다양한 구문 변경으로 C++와의 호환성 향상(예: 선언 전 레이블, 이름 없는 함수 인수, 초기화 제로)
{}
, 명명된 인수가 없는 가변 함수, C++11 스타일 속성,_Static_assert
(구문 참조). 복합문의 끝에 있는 라벨의 경우 C++23으로 해당 변경이 이루어졌습니다.[43] - C++-style 특성을 추가합니다(구문 참조). 속성 추가
[[deprecated]]
,[45][[fallthrough]]
,[46][[maybe_unused]]
,[47][[nodiscard]]
,[48]그리고[48][[noreturn]]
C++11과의 호환성을 위해 속성을 지정한 다음 사용을 중지합니다._Noreturn
,noreturn
, 머리말<stdnoreturn.h>
C11에 소개된 기능입니다.[49] C++23과의 호환성을 위해 속성 중복이 허용됩니다.[50] 모든 표준 특성은 이중 밑줄로 둘러쌀 수도 있습니다(예:[[__deprecated__]]
와 맞먹습니다.[[deprecated]]
). - 더하다
u8
문자 리터럴의 접두사는 C++17과의 호환성을 위해 UTF-8 인코딩을 나타냅니다.[51][52] - 더하다
#elifdef
그리고.#elifndef
C++23과의 호환성을 위한 전처리 지침("[14]preprocessor" group 참조)
기타 기능
- ISO/IEC 60559:2020 지원, 현재 버전의 부동소수점 연산을 위한 IEEE 754 표준, 확장된 이진 부동소수점 연산 및 (옵션)[53][54] 소수점 부동소수점 연산.
- 그
constexpr
개체에 대해 지정하지만 C++의 등가물과 달리 함수에 대해서는 지정하지 않습니다.[55] - 더하다
char8_t
UTF-8 인코딩된 데이터를 저장하기 위해 입력하고 u8 문자 상수 및 문자열 리터럴의 유형을 다음과 같이 변경합니다.char8_t
. 또한, 기능들은mbrtoc8()
그리고.c8rtomb()
좁은 멀티바이트 문자를 UTF-8 인코딩으로 변환하고, UTF-8의 단일 코드 포인트를 좁은 멀티바이트 문자 표현으로 변환합니다.[56] - 모든 것을 명확히 합니다.
char16_t
문자열 및 리터럴은 UTF-16으로 인코딩되어야 하며, 모든 것을 인코딩해야 합니다.char32_t
문자열 및 리터럴은 명시적으로 명시되지 않는 한 UTF-32 인코딩되어야 합니다.[57] - 복합 리터럴 정의에 스토리지 클래스 지정자를 표시할 수 있습니다.[58]
더 이상 사용되지 않는 기능
일부 오래된 오래된 기능은 C23의 작업 초안에서 제거되거나 더 이상 사용되지 않습니다.
컴파일러 지원
GCC 9,[64] Clang 9.0 [65]및 Pelles C 11.00[66] 컴파일러는 이 표준을 지원하기 위해 실험 컴파일러 플래그를 구현합니다.
참고 항목
참고문헌
- ^ "History of C". cppreference.com. 2022-06-27. Archived from the original on October 19, 2022.
- ^ "WG14-N2086 : C2x Charter". open-std.org. 2016-09-20. Archived from the original on December 22, 2022.
- ^ "WG14-N3156 : Updated C23 Schedule" (PDF). open-std.org. 2023-07-19. Archived (PDF) from the original on January 29, 2024.
- ^ a b "WG14-N3096 : Draft for ISO/IEC 9899:2024" (PDF). open-std.org. April 1, 2023. Archived (PDF) from the original on April 2, 2023.
- ^ "WG14-N2437 : Agenda for October 2019". open-std.org. 2019-10-21. Archived from the original on March 5, 2021.
- ^ "WG14-N2897 : memset_explicit()". open-std.org. 2021-12-27. Archived from the original on October 25, 2022.
- ^ "WG14-N2349 : Toward more efficient string copying and concatenation". open-std.org. 2019-03-18. Archived from the original on September 30, 2022.
- ^ "WG14-N2353 : strdup() and strndup()". open-std.org. 2019-03-18. Archived from the original on December 24, 2022.
- ^ "WG14-N2974 : Queryable pointer alignment" (PDF). open-std.org. 2022-04-15. Archived (PDF) from the original on October 13, 2022.
- ^ a b c d e f g h i j k "WG14-N3022 : Modern Bit Utilities". open-std.org. 2022-07-06. Archived from the original on December 24, 2022.
- ^ "WG14-N2833 : Add timegm() as non-optional part of time.h". open-std.org. 2021-10-07. Archived from the original on December 1, 2021.
- ^ a b c "WG14-N2630 : formatted input/output of binary integer numbers" (PDF). open-std.org. 2021-01-01. Archived (PDF) from the original on December 14, 2022.
- ^ "WG14-N3020 : Qualifier-preserving standard library functions" (PDF). open-std.org. 2022-06-13. Archived (PDF) from the original on October 13, 2022.
- ^ a b "WG14-N2645 : Add support for preprocessing directives #elifdef and #elifndef" (PDF). open-std.org. 2020-01-25. Archived (PDF) from the original on November 28, 2022.
- ^ "GCC 12 Adds Support For New #elifdef #elifndef Directives". phoronix. May 12, 2021. Archived from the original on December 27, 2022.
- ^ "WG14-N3017 : #embed - a scannable, tooling-friendly binary resource inclusion mechanism". open-std.org. 2022-06-27. Archived from the original on December 24, 2022.
- ^ "WG14-N2686 : #warning" (PDF). open-std.org. 2022-07-22. Archived (PDF) from the original on November 28, 2022.
- ^ "WG14-N2799 : __has_include for C" (PDF). open-std.org. 2021-08-30. Archived (PDF) from the original on December 24, 2022.
- ^ "WG14-N2553 : Querying attribute support" (PDF). open-std.org. 2020-08-04. Archived (PDF) from the original on October 14, 2022.
- ^ "WG14-N3033 : Comma omission and comma deletion". open-std.org. 2022-07-20. Archived from the original on December 27, 2022.
- ^ a b "WR14-N3042 : Introduce the nullptr constant". open-std.org. 2022-07-22. Archived from the original on December 24, 2022.
- ^ "WG14-N2763 : Adding a Fundamental Type for N-bit integers" (PDF). open-std.org. 2021-06-21. Archived (PDF) from the original on December 27, 2022.
- ^ "WG14-N3035 : _BitInt Fixes" (PDF). open-std.org. 2022-07-21. Archived (PDF) from the original on October 13, 2022.
- ^ "WG14-N2867 : Checked N-Bit Integers" (PDF). open-std.org. 2021-11-28. Archived (PDF) from the original on December 14, 2022.
- ^ "WG14-N2778 : Variably-Modified Types" (PDF). open-std.org. 2021-07-11. Archived (PDF) from the original on December 22, 2022.
- ^ "WG14-N2607 : Compatibility of Pointers to Arrays with Qualifiers" (PDF). open-std.org. 2020-10-31. Archived (PDF) from the original on October 13, 2022.
- ^ "WG14-N2899 : Not-so-magic - typeof for C". open-std.org. 2022-01-21. Archived from the original on December 24, 2022.
- ^ "WG14-N3007 : Type inference for object definitions". open-std.org. 2022-06-10. Archived from the original on December 24, 2022.
- ^ "WG14-N3037 : Improved Rules for Tag Compatibility (updates N3032)" (PDF).
- ^ "WG14-N2775 : Literal suffixes for bit-precise integers" (PDF). open-std.org. 2021-07-13. Archived (PDF) from the original on December 27, 2022.
- ^ "WG14-N2549 : Allow for binary integer constants" (PDF). open-std.org. 2020-07-30. Archived (PDF) from the original on December 22, 2022.
- ^ "WG14-N2626 : Digit separators" (PDF). open-std.org. 2020-12-15. Archived (PDF) from the original on December 19, 2022.
- ^ "WG14-N3030 : Enhancements to Enumerations". open-std.org. 2022-07-19. Archived from the original on November 26, 2022.
- ^ "WG14-N3029 : Improved Normal Enumerations". open-std.org. 2022-07-19. Archived from the original on January 29, 2023.
- ^ "WG14-N2935 : Make false and true first-class language features" (PDF). open-std.org. 2022-02-15. Archived (PDF) from the original on November 21, 2022.
- ^ "WG14-N2934 : Revise spelling of keywords" (PDF). open-std.org. 2022-02-15. Archived (PDF) from the original on December 24, 2022.
- ^ "WG14-N2508 : Free Positioning of Labels Inside Compound Statements" (PDF). open-std.org. 2020-03-28. Archived (PDF) from the original on December 27, 2022.
- ^ "WG14-N2510 : Allowing unnamed parameters in a function definition" (PDF). open-std.org. 2020-04-09. Archived (PDF) from the original on December 24, 2022.
- ^ "WG14-N2900 : Consistent, Warningless, and Intuitive Initialization with {}". open-std.org. 2022-01-01. Archived from the original on December 27, 2022.
- ^ "WG14-N2975 : Relax requirements for variadic parameter lists" (PDF). open-std.org. 2022-04-15. Archived (PDF) from the original on November 28, 2022.
- ^ "WG14-N2335 : Attributes in C" (PDF). open-std.org. 2019-03-09. Archived (PDF) from the original on October 26, 2022.
- ^ "WG14-N2265 : Harmonizing static_assert with C++" (PDF). open-std.org. 2018-07-06. Archived (PDF) from the original on March 28, 2023.
- ^ "Labels at the end of compound statements (C compatibility)" (PDF). 2022-01-13.
- ^ "WG14-N2554 : Minor attribute wording cleanups" (PDF). open-std.org. 2020-08-04. Archived (PDF) from the original on November 28, 2022.
- ^ "WG14-N2334 : The deprecated attribute" (PDF). open-std.org. 2019-01-22. Archived (PDF) from the original on October 19, 2022.
- ^ "WG14-N2408 : The fallthrough attribute" (PDF). open-std.org. 2019-08-11. Archived (PDF) from the original on December 25, 2022.
- ^ "WG14-N2270 : The maybe_unused attribute" (PDF). open-std.org. 2018-07-06. Archived (PDF) from the original on December 25, 2022.
- ^ "WG14-N2267 : The nodiscard attribute" (PDF). open-std.org. 2018-07-06. Archived (PDF) from the original on October 19, 2022.
- ^ "WG14-N2764 : The noreturn attribute" (PDF). open-std.org. 2021-06-21. Archived (PDF) from the original on December 25, 2022.
- ^ "WG14-N2557 : Allow Duplicate Attributes" (PDF). open-std.org. 2020-09-01. Archived (PDF) from the original on November 28, 2022.
- ^ "WG14-N2418 : Adding the u8 character prefix" (PDF). open-std.org. 2019-09-02. Archived (PDF) from the original on January 13, 2023.
- ^ C++17용으로 제안된 UTF-8 문자 리터럴의 의미는 무엇입니까? 스택 오버플로.
- ^ "WG14-N2341 : ISO/IEC TS 18661-2 - Floating-point extensions for C - Part 2: Decimal floating-point arithmetic" (PDF). open-std.org. February 26, 2019. Archived (PDF) from the original on November 21, 2022.
- ^ "WG14-N2601 : Annex X - IEC 60559 interchange and extended types" (PDF). open-std.org. October 15, 2020. Archived (PDF) from the original on October 14, 2022.
- ^ "WG14-N3018 : The constexpr specifier for object definitions". open-std.org. 2022-07-06. Archived from the original on December 24, 2022.
- ^ "WG14-N2653 : char8_t: A type for UTF-8 characters and strings (Revision 1)". open-std.org. 2021-06-04. Archived from the original on May 27, 2023.
- ^ "WG14-N2728 : char16_t & char32_t string literals shall be UTF-16 & UTF-32". open-std.org. 2021-05-15. Archived from the original on May 27, 2023.
- ^ "WG14-N3038 : Introduce storage-class specifiers for compound literals". open-std.org. 2022-07-21. Archived from the original on November 26, 2022.
- ^ "WG14-N2940 : Removing trigraphs??!" (PDF). open-std.org. 2022-03-02. Archived (PDF) from the original on October 26, 2022.
- ^ "WG14-N2432 : Remove support for function definitions with identifier lists proposal" (PDF). open-std.org. September 25, 2019. Archived (PDF) from the original on December 27, 2022.
- ^ "WG14-N2841 : No function declarators without prototypes". open-std.org. 2021-10-10. Archived from the original on November 12, 2022.
- ^ "WG14-N2412 : Two's complement sign representation" (PDF). open-std.org. August 11, 2019. Archived (PDF) from the original on December 27, 2022.
- ^ "WG14-N2993 : Make *_HAS_SUBNORM be obsolescent". open-std.org. 2022-06-06. Archived from the original on December 5, 2022.
- ^ "GCC 9 Release Notes". GNU Project. Archived from the original on December 27, 2022.
- ^ "Clang 9.0 - add new language mode for C2x". LLVM Project Repository. May 14, 2019. Archived from the original on December 27, 2022.
- ^ "Pelles C - major changes between 10.00 and 11.00". smorgasbordet.com. Archived from the original on December 27, 2022.
추가읽기
- N3096(C23 표준 작업 초안); WG14; 2023년 4월(무료 다운로드)
- N3149(C23 표준 작업 초안); WG14; 2023년 7월. (공개 불가)
- N3219(ISO/IEC 9899:2023 DIS 초안); WG14; 2024년 2월. (ISO 초안 제공은 가능하나 무료는 아님)
- ISO/IEC 9899:2024 (공식 C23 표준); ISO; 2024. (2024년 출시 예정)