什么是 C17 以及对语言进行了哪些更改?
What is C17 and what changes have been made to the language?
当我查看有关 GCC 8 的新闻时,我 saw 他们增加了对 2017 版 C 语言(不是 C++17,真正的 C17)的支持。但是我在互联网上找不到任何关于它的信息。
它是像 C11 这样的新 ISO 版本,还是只是 GCC 团队在其编译器中进行一些更正的代号?
根据 GCC 参考资料,C17
实际上是 错误修复版本 C11
标准,集成了 DR 分辨率。
C17, a bug-fix version of the C11 standard with DR [Defect Report] resolutions
integrated, will soon go to ballot. This patch adds corresponding
options -std=c17
, -std=gnu17
(new default version, replacing
-std=gnu11
as the default), -std=iso9899:2017
. As a bug-fix version
of the standard, there is no need for flag_isoc17
or any options for
compatibility warnings; however, there is a new __STDC_VERSION__
value, so new cpplib languages CLK_GNUC17
and CLK_STDC17
are added to
support using that new value with the new options. (If the standard
ends up being published in 2018 and being known as C18
, option aliases
can be added. Note however that -std=iso9899:199409
corresponds to a
__STDC_VERSION__
value rather than a publication date.)
(There are a couple of DR resolutions needing implementing in GCC, but
that's independent of the new options.)
因此,C17 中没有包含任何新功能。
Cppreference (History of C) 说:
Future development
C17 Next minor C language standard revision, will include all accepted C11 defect reports, but no new features.
更新:
- 2018: C17 (ISO/IEC 9899:2018) (ISO Store) (Final draft) Includes the deprecation of
ATOMIC_VAR_INIT
and the fixes to the
following defect reports:
[DR 400], [DR 401], [DR 402], [DR 403],
[DR 404], [DR 405], [DR 406], [DR 407],
[DR 410], [DR 412], [DR 414], [DR 415],
[DR 416], [DR 417], [DR 419], [DR 423],
[DR 426], [DR 428], [DR 429], [DR 430],
[DR 431], [DR 433], [DR 434], [DR 436],
[DR 437], [DR 438], [DR 439], [DR 441],
[DR 444], [DR 445], [DR 447], [DR 448],
[DR 450], [DR 452], [DR 453], [DR 457],
[DR 458], [DR 459], [DR 460], [DR 462],
[DR 464], [DR 465], [DR 468], [DR 470],
[DR 471], [DR 472], [DR 473], [DR 475],
[DR 477], [DR 480], [DR 481], [DR 485],
[DR 487], [DR 491]
C17
是“M.S Chaudhari
”注意到的 C 标准的“错误修复版本”。然而,Jens Gustedt
"Modern C"
书的作者准备了非常有用的信息。
他确定了 C17
与 C11
相比的以下变化列表:
atomics: initialization (7.17.2, 7.31.8), coherence requirements (5.1.2.4), fences (7.17.3 p11), functions or macros (7.17.1 p6), lockfree depends on type (7.17.5 p3), compare exchange compares memory and not value (7.17.7.3), atomic_flag (7.17.18).
threads: spurious failures (7.26.3.5 p2, 7.26.3.6 p2, 7.26.4.5 p3), synchronization (7.26.4 p1), thread specific storage (tss_t
) and thread exit (7.26.5 p3, 7.26.5.5, 7.26.6)
alignment: fundamental alignment (6.2.8), _Alignas
(6.7.5), aligned_alloc
(7.22.3.1)
sequence points: full expressions (6.8 p4), full declarators (6.7..6 p3)
infinite loops (6.8.5 p6)
reserved identifiers (7.1.3)
domain or range errors (7.12.1), ilogb
, erfc
, lgamma
.
underspecification of clock
(7.27.2.1)
underspecification of realloc
for size 0 (7.22.3.5)
Annex F: FLT_ROUNDS
(F.2 p1)
Annex K: tmpnam_s
, snprintf_s
, sprintf_s
, vsprintf_s
, get_s
, mbstowcs_s
, wcstombs_s
, snwprintf_s
, swprintf_s
, vsnwprintf_s
, vswprint_s
, mbsrtowcs_s
, wcsrtombs_s
.
Link到主页C17.
此外,此内容将由Jens
更新,您可以关注更新
这里 Jeans Gustedt Blog.
P.S: before posting all this stuff I received approval from the author.
当我查看有关 GCC 8 的新闻时,我 saw 他们增加了对 2017 版 C 语言(不是 C++17,真正的 C17)的支持。但是我在互联网上找不到任何关于它的信息。
它是像 C11 这样的新 ISO 版本,还是只是 GCC 团队在其编译器中进行一些更正的代号?
根据 GCC 参考资料,C17
实际上是 错误修复版本 C11
标准,集成了 DR 分辨率。
C17, a bug-fix version of the C11 standard with DR [Defect Report] resolutions integrated, will soon go to ballot. This patch adds corresponding options
-std=c17
,-std=gnu17
(new default version, replacing-std=gnu11
as the default),-std=iso9899:2017
. As a bug-fix version of the standard, there is no need forflag_isoc17
or any options for compatibility warnings; however, there is a new__STDC_VERSION__
value, so new cpplib languagesCLK_GNUC17
andCLK_STDC17
are added to support using that new value with the new options. (If the standard ends up being published in 2018 and being known asC18
, option aliases can be added. Note however that-std=iso9899:199409
corresponds to a__STDC_VERSION__
value rather than a publication date.)(There are a couple of DR resolutions needing implementing in GCC, but that's independent of the new options.)
因此,C17 中没有包含任何新功能。
Cppreference (History of C) 说:
Future development
C17 Next minor C language standard revision, will include all accepted C11 defect reports, but no new features.
更新:
- 2018: C17 (ISO/IEC 9899:2018) (ISO Store) (Final draft) Includes the deprecation of
ATOMIC_VAR_INIT
and the fixes to the following defect reports:[DR 400], [DR 401], [DR 402], [DR 403], [DR 404], [DR 405], [DR 406], [DR 407], [DR 410], [DR 412], [DR 414], [DR 415], [DR 416], [DR 417], [DR 419], [DR 423], [DR 426], [DR 428], [DR 429], [DR 430], [DR 431], [DR 433], [DR 434], [DR 436], [DR 437], [DR 438], [DR 439], [DR 441], [DR 444], [DR 445], [DR 447], [DR 448], [DR 450], [DR 452], [DR 453], [DR 457], [DR 458], [DR 459], [DR 460], [DR 462], [DR 464], [DR 465], [DR 468], [DR 470], [DR 471], [DR 472], [DR 473], [DR 475], [DR 477], [DR 480], [DR 481], [DR 485], [DR 487], [DR 491]
C17
是“M.S Chaudhari
”注意到的 C 标准的“错误修复版本”。然而,Jens Gustedt
"Modern C"
书的作者准备了非常有用的信息。
他确定了 C17
与 C11
相比的以下变化列表:
atomics: initialization (7.17.2, 7.31.8), coherence requirements (5.1.2.4), fences (7.17.3 p11), functions or macros (7.17.1 p6), lockfree depends on type (7.17.5 p3), compare exchange compares memory and not value (7.17.7.3), atomic_flag (7.17.18).
threads: spurious failures (7.26.3.5 p2, 7.26.3.6 p2, 7.26.4.5 p3), synchronization (7.26.4 p1), thread specific storage (
tss_t
) and thread exit (7.26.5 p3, 7.26.5.5, 7.26.6)alignment: fundamental alignment (6.2.8),
_Alignas
(6.7.5),aligned_alloc
(7.22.3.1)sequence points: full expressions (6.8 p4), full declarators (6.7..6 p3)
infinite loops (6.8.5 p6)
reserved identifiers (7.1.3)
domain or range errors (7.12.1),
ilogb
,erfc
,lgamma
.underspecification of
clock
(7.27.2.1)underspecification of
realloc
for size 0 (7.22.3.5)Annex F:
FLT_ROUNDS
(F.2 p1)Annex K:
tmpnam_s
,snprintf_s
,sprintf_s
,vsprintf_s
,get_s
,mbstowcs_s
,wcstombs_s
,snwprintf_s
,swprintf_s
,vsnwprintf_s
,vswprint_s
,mbsrtowcs_s
,wcsrtombs_s
.
Link到主页C17.
此外,此内容将由Jens
更新,您可以关注更新
这里 Jeans Gustedt Blog.
P.S: before posting all this stuff I received approval from the author.