[英]C headers conformance
我正在尋找 C 標准庫標頭一致性報告的列表 - 例如,對於所有 C 標准(或至少是 C20),哪些標頭是可選的,哪些是符合標准的編譯器所必需的。
C17(當前的 C 標准)將標准頭列為:
<assert.h> <math.h> <stdlib.h>
<complex.h> <setjmp.h> <stdnoreturn.h>
<ctype.h> <signal.h> <string.h>
<errno.h> <stdalign.h> <tgmath.h>
<fenv.h> <stdarg.h> <threads.h>
<float.h> <stdatomic.h> <time.h>
<inttypes.h> <stdbool.h> <uchar.h>
<iso646.h> <stddef.h> <wchar.h>
<limits.h> <stdint.h> <wctype.h>
<locale.h> <stdio.h>
該標准在第 7.1.2 節“標准標頭”的腳注中說明了這一點:
標頭 <complex.h>、<stdatomic.h> 和 <threads.h> 是實現不需要支持的條件特性; 見 6.10.8.3
第 6.10.8.3 節(“條件特征宏”)依次對這些標頭進行了說明:
__STDC_NO_ATOMICS__
integer 常量 1,意在表明實現不支持原子類型(包括 _Atomic 類型限定符)和<stdatomic.h>
header。
__STDC_NO_COMPLEX__
integer 常量1,意在表明實現不支持復雜類型或<complex.h>
header。
__STDC_NO_THREADS__
integer常量1,意在表示不支持<threads.h>
header的實現。
最后,C17 說了關於“符合獨立”的實現(第 4 節“一致性”):
符合標准的獨立實現應接受任何嚴格符合標准的程序,其中庫條款(第 7 條)中指定的功能的使用僅限於標准標頭
<float.h>
、<iso646.h>
、<limits.h>
、<stdalign.h>
、<stdarg.h>
、<stdbool.h>
、<stddef.h>
、stdint.h>
和<stdnoreturn.h>
。
cppreference.com 將為您提供 C89 到 C23 和 C++98 到 C++23 的所有標准。 雖然沒有 C20 標准,但 C17 是最后一個,C23 是下一個。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.