对于许多问题,答案似乎在“标准”中找到。然而,我们在哪里找到它呢?最好是网上。

谷歌有时会让人觉得毫无意义,尤其是对于C标准,因为它们淹没在编程论坛上的讨论洪流中。

首先,因为这些是我现在正在搜索的,哪里有好的在线资源:

C89 C99 C11 C + + 98 c++ 03 c++ 11 c++ 14 c++ 17


ISO标准需要花钱,从中等数额(PDF版本)到稍微多一点(纸质版本)。

虽然它们还没有最终定稿,但通常可以在网上找到草稿。大多数情况下,最终版本与上一版没有太大的不同,所以虽然不完美,但它们也很合适。

c++ 0x草案


ISO C和c++标准非常昂贵。另一方面,INCITS重新出版的费用要低得多。http://www.techstreet.com/网站上的PDF文档售价30美元 (搜寻INCITS/ISO/ iec14882:2003)。

也有硬拷贝版本。请查阅Wiley出版的英国标准协会版本。


您可能会发现c++ 0x的国际标准草案很有用。


C99和c++ 03标准可从Wiley以书籍的形式获得:

Amazon上的c++标准 C亚马逊标准

此外,如前所述,未来标准的工作草案通常可从委员会网站获得:

c++委员会网站 C委员会网站

C-201x草案是N1336, c++ 0x草案是N3225。


标准的PDF版本

从2014年9月1日到2022年3月,PDF格式的官方C和c++标准文档的最佳价格位置似乎是:

C++20 – ISO/IEC 14882:2020: 212 CAD (about $165 US) from csagroup.org C++17 – ISO/IEC 14882:2017: $90 NZD (about $65 US) from Standards New Zealand C++14 – ISO/IEC 14882:2014: $90 NZD (about $65 US) from Standards New Zealand C++11 – ISO/IEC 14882-2011: $60 from ansi.org or $60 from Techstreet C++03 – INCITS/ISO/IEC 14882:2003: $30 from ansi.org C++98 – ISO/IEC 14882:1998: $95 NZD (about $65 US) from Standards New Zealand C17/C18 – INCITS/ISO/IEC 9899:2018: $116 from INCITS/ANSI / N2176 / c17_updated_proposed_fdis.pdf draft from November 2017 (Link broken, see Wayback Machine N2176) C11 – ISO/IEC 9899:2011: $60 from ansi.org / WG14 draft version N1570 C99 – INCITS/ISO/IEC 9899-1999(R2005): $60 from ansi.org / WG14 draft version N1256 C90 – ISO/IEC 9899:1990: $90 NZD (about $65 USD) from Standards New Zealand

标准的非pdf电子版本

警告:标准草案的大多数副本都以PDF格式发布,如果文本/HTML是从PDF转录或自动生成的,则可能会引入错误。

C89 – Draft version in ANSI text format: (https://web.archive.org/web/20161223125339/http://flash-gordon.me.uk/ansi.c.txt) C89 – Draft version as HTML document: (http://port70.net/~nsz/c/c89/c89-draft.html) C90 TC1; ISO/IEC 9899 TCOR1, single-page HTML document: (http://www.open-std.org/jtc1/sc22/wg14/www/docs/tc1.htm) C90 TC2; ISO/IEC 9899 TCOR2, single-page HTML document: (http://www.open-std.org/jtc1/sc22/wg14/www/docs/tc2.htm) C99 – Draft version (N1256) as HTML document: (http://port70.net/~nsz/c/c99/n1256.html) C11 – Draft version (N1570) as HTML document: (http://port70.net/~nsz/c/c11/n1570.html) C++11 – Working draft (N3337) as plain text document: (http://port70.net/~nsz/c/c%2B%2B/c%2B%2B11_n3337.txt)

(托管c++ 11工作草案纯文本版本的站点也有这种格式的一些c++ 14草案。但它们都不是最终工作草案N4140的副本。)

标准的印刷版本

这些标准的印刷本可以从国家标准机构和ISO获得,但非常昂贵。

如果你想要一份C90标准的硬拷贝,花费比上面少得多的钱,你可以在亚马逊上找到Herb Schildt的书the Annotated ANSI standard的廉价二手副本,其中包含了标准的实际文本(有用)和对标准的注释(不太有用——它包含了几个危险和误导性的错误)。

C99和c++ 03标准可以从Wiley和BSI(英国标准协会)获得:

c++ 03标准的亚马逊 亚马逊C99标准

标准委员会草案版本(免费)

未来标准的工作草案通常可从委员会网站获得:

c++委员会网站 C委员会网站

如果你想获得当前或更早的C/ c++标准的草案,在互联网上有一些免费的:

C:

ANSI X3.159-198 (C89): I cannot find a PDF of C89, but it is almost the same as C90. The only major differences are in the boilerplate and section numbering, although there are some slight textual differences ISO/IEC 9899:1990 (C90): (Almost the same as ANSI X3.159-198 (C89) except for the frontmatter and section numbering. There is at least one textual difference in section 6.5.7 (previously 3.5.7), where "a list" became "a brace-enclosed list". Note that the conversion between ANSI and ISO/IEC Standard is seen inside this document, the document refers to its name as "ANSI/ISO: 9899/99" although this isn't the right name of the later made standard of it, the right name is "ISO/IEC 9899:1990") TC1 for C90: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n423.pdf There isn't a PDF link for TC2 on the WG14 website, sadly. ISO/IEC 9899:1999 (C99 incorporating all three Technical Corrigenda): http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf An earlier version of C99 incorporating only TC1 and TC2: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf Working draft for the original (i.e. pre-corrigenda) C99: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n843.htm (HTML) and http://www.dkuug.dk/JTC1/SC22/WG14/www/docs/n843.pdf (PDF). Note that there were two later working drafts: N869 and N878, but they seem to have been removed from the WG14 website, so this is the latest one available. List of changes between C89/C90 and C99: http://port70.net/~nsz/c/c89/c9x_changes.html TC1 for C99 (only the TC, not the standard incorporating it): http://www.open-std.org/jtc1/sc22/wg14/www/docs/9899tc1/n32071.PDF TC2 for C99 (only the TC, not the standard incorporating it): http://www.open-std.org/jtc1/sc22/wg14/www/docs/9899-1999_cor_2-2004.pdf ISO/IEC 9899:2011 (C11): http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf For information on the differences between N1570 and the final, published version of C11, see Latest changes in C11 and https://groups.google.com/g/comp.std.c/c/v5hsWOu5vSw ISO/IEC 9899:2011/Cor 1:2012 (C11's only technical corrigendum): This can be viewed at https://www.iso.org/obp/ui/#iso:std:iso-iec:9899:ed-3:v1:cor:1:v1:en but cannot be downloaded. It is the actual corrigendum, not a draft. ISO/IEC 9899:2018 (C17/C18): https://web.archive.org/web/20181230041359if_/http://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf (N2176) C23 work-in-progress - latest working draft as of 24th January 2023 (N3088): https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3088.pdf Previous working draft of 7th August 2022 (N3047): http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf

美国小妞C + +:

ISO/IEC 14882:1998 (C++98): http://www.lirmm.fr/~ducour/Doc-objets/ISO+IEC+14882-1998.pdf ISO/IEC 14882:2003 (C++03): https://cs.nyu.edu/courses/fall11/CSCI-GA.2110-003/documents/c++2003std.pdf ISO/IEC 14882:2011 (C++11): http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf ISO/IEC 14882:2014 (C++14): https://github.com/cplusplus/draft/blob/master/papers/n4140.pdf?raw=true ISO/IEC 14882:2017 (C++17): http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4659.pdf ISO/IEC 14882:2020 (C++20): https://isocpp.org/files/papers/N4860.pdf ISO/IEC 14882:2023 (C++23 work-in-progress. Working draft dated March 17 2022): https://open-std.org/JTC1/SC22/WG21/docs/papers/2022/n4910.pdf

请注意,这些文档与标准并不相同,尽管在决定标准的会议之前的版本通常非常接近最终标准。FCD(最终委员会草案)版本有密码保护;你需要加入标准委员会才能得到它们。

尽管草案版本可能非常接近标准的最终批准版本,但本文的一些编辑强烈建议你获得一份实际文件的副本——特别是如果你打算引用它们作为参考的话。当然,如果囊中羞涩,饥肠辘辘的学生也可以使用汇票。


看来,如果您愿意并且能够在标准批准后等待几个月,在寻找标准时搜索“INCITS/ISO/IEC”而不是“ISO/IEC”是关键。通过这样做,本文的一位编辑能够以合理的价格找到C11和c++ 11标准。例如,如果你在webstore.ansi.org上搜索“INCITS/ISO/IEC 9899:2011”而不是“ISO/IEC 9899:2011”,你会找到价格合理的PDF版本。


https://wg21.link/网站提供了c++当前工作草案和标准草案以及委员会文件的短url链接:

https://wg21.link/std11 - c++ 11 https://wg21.link/std14 - c++ 14 https://wg21.link/std17 - c++ 17 https://wg21.link/std20 - c++ 20 https://wg21.link/std -当前工作草案(截至2022年5月仍指向2021年版本)


目前的标准草案在Github上作为LaTeX源进行维护。可以使用cxxdraft-htmlgen将这些源代码转换为HTML。以下网站维护HTML页面生成:

Tim Song -当前工作草案- c++ 11 - c++ 14 - c++ 17 - c++ 20 Eelis -当前工作草案

Tim Song还维护生成的HTML和PDF版本的Networking TS和Ranges TS。

POSIX对C标准的扩展

POSIX标准(IEEE 1003.1)要求兼容的操作系统包含C编译器。这个编译器必须与C标准兼容,并且还必须支持POSIX“系统接口”部分中定义的各种扩展(例如off_t数据类型,<aio.h>标头,clock_gettime()函数和_POSIX_C_SOURCE宏)。

因此,如果你试图查找一个特定的函数,被告知“这个函数是POSIX的一部分,而不是C标准”,并且想知道为什么操作系统标准强制要求编译器特性和语言扩展……现在你知道了!

POSIX.1-2001: The System Interfaces section can be downloaded as a separate document from https://mirror.math.princeton.edu/pub/oldlinux/download/c951.pdf. Section 1.7 states that the relevant version of the C standard is C99. The "Shell and Utilities" section (https://mirror.math.princeton.edu/pub/oldlinux/download/c952.pdf) mandates not only that a C99-compliant compiler should exist, but that it should be invokable from the command line under the name "c99". One way in which this can be implemented is to place a shell script called "c99" in /usr/bin, which calls gcc with the -std=c99 option added to the list of command-line parameters, and blocks any competing standards from being specified. POSIX.1-2001 had two technical corrigenda, one dated 2002 and one dated 2004. I don't think they're incorporated into the documents as linked above. There's an online HTML version incorporating the corrigenda at https://pubs.opengroup.org/onlinepubs/009695399/ - but I should add that I've had some trouble with the search box and so using Google to search the site is probably your best bet. There is a paywalled link to download the first corrigendum at https://standards.ieee.org/standard/1003_1-2001-Cor1-2002.html. There is also a paywalled link for the second at https://standards.ieee.org/standard/1003_1-2001-Cor2-2004.html

There is a draft version of POSIX.1-2008 at http://www.open-std.org/jtc1/sc22/open/n4217.pdf. POSIX.1-2008 also had two technical corrigenda, the latter of the two being dated 2016. There is an online HTML version of the standard incorporating the corrigenda at https://pubs.opengroup.org/onlinepubs/9699919799.2016edition/ - though, again, I have had situations where the site's own search box wasn't good for finding information. There is an online HTML version of POSIX.1-2017 at https://pubs.opengroup.org/onlinepubs/9699919799/ - though, again, I recommend using Google instead of that site's searchbox. According to the Open Group website "IEEE 1003.1-2017 ... is a revision to the 1003.1-2008 standard to rollup the standard including its two technical corrigenda (as-is)". Linux manpages describe it as "technically identical" to POSIX.1-2008 with Technical Corrigenda 1 and 2 applied. This is therefore not a major revision and does not change the value of the _POSIX_C_SOURCE macro.


C99可在线购买。引用自www.open-std.org:

该标准的最新公开版本是 合并C99 + TC1 + TC2 + TC3, WG14 N1256,日期2007-09-07。这是 WG14的工作文件,但它反映了统一的标准 发行时间。


实际的标准文档可能不是最有用的。大多数编译器并没有完全实现这些标准,有时甚至会发生冲突。所以你已经有的编译器文档会更有用。此外,文档将包含特定于平台的注释和任何注意事项。


该标准的在线版本可以在以下网站找到:

编程语言c++标准工作草案

以下是本标准的所有草案版本:

以下所有内容均可免费下载 2022-12-18: N4928 2022-09-05: N4917 2022-03-17: N4910 2021-10-22: N4901 2021-06-18: N4892 2021-03-17: N4885 2020-12-15: N4878 2020-10-18: N4868 2020-04-08: N4861

这是c++ 20标准: 此版本需要身份验证 2020-04-08: N4860

以下是本标准的所有草案版本: 以下所有内容均可免费下载 (其中许多可以在这个GitHub主链接上找到) 2020-01-14: N4849 2019-11-27: N4842 2019-10-08: N4835 git 2019-08-15: N4830 git 2019-06-17: N4820 git 2019-03-15: N4810 git 2019-01-21: N4800 git 2018-11-26: N4791 git 2018-10-08: N4778 git 2018-07-07: N4762 git 2018-05-07: N4750 git 2018-04-02: N4741 git 2018-02-12: N4727 git 2017-11-27: N4713 git 2017-10-16: N4700 git 2017-07-30: N4687 git

这是旧的c++ 17标准: 此版本需要身份验证 2017-03-21: N4660

以下是本标准的所有草案版本: 以下所有内容均可免费下载 2017-03-21: N4659 git 2017-02-06: N4640 git 2016-11-28: N4618 git 2016-07-12: N4606 git 2016-05-30: N4594 git 2016-03-19: N4582 git 2015-11-09: N4567 git 2015-05-22: N4527 git 2015-04-10: N4431 git 2014-11-19: N4296 git

这是旧的c++ 14标准: 这些版本需要身份验证 2014-10-07: N4140 git基本上是c++ 14的小错误和错别字更正 2014-09-02: N4141 git Standard c++ 14 2014-03-02: N3937 2014-03-02: N3936 git

以下是本标准的所有草案版本: 以下所有内容均可免费下载 2013-10-13: N3797 git 2013-05-16: N3691 2013-05-15: N3690 2012-11-02: N3485 2012-02-28: N3376 2012-01-16: N3337 git基本上是c++ 11,有一些小错误和错别字更正

这是旧的c++ 11标准: 此版本需要身份验证 2011-04-05: N3291

The following all draft versions of the standard: All the following are freely downloadable 2011-02-28: N3242 (differences from N3291 very minor) 2010-11-27: N3225 2010-08-21: N3126 2010-03-29: N3090 2010-02-16: N3035 2009-11-09: N3000 2009-09-25: N2960 2009-06-22: N2914 2009-03-23: N2857 2008-10-04: N2798 2008-08-25: N2723 2008-06-27: N2691 2008-05-19: N2606 2008-03-17: N2588 2008-02-04: N2521 2007-10-22: N2461 2007-08-06: N2369 2007-06-25: N2315 2007-05-07: N2284 2006-11-03: N2134 2006-04-21: N2009 2005-10-19: N1905 2005-04-27: N1804

这是旧的c++ 03标准: 以下所有版本都需要身份验证 2004-11-05: N1733 2004-07-16: N1655非官方 2004-02-07: N1577 c++ 03(或非常接近) 2001-09-13: N1316扩展技术勘误表草案 1997-00-00: N1117扩展技术勘误表草案

以下是本标准的所有草案版本: 以下所有内容均可免费下载 1996-00-00: N0836扩展技术勘误表草案 1995-00-00: N0785信息系统国际标准草案-程序设计语言c++

其他有趣的论文:

2023/2022 / 2021/ 2020 / 2019 / 2018 / 2017 / 2016 / 2015 / 2014 / 2013 / 2012 / 2011


草案链接:

c++ 11(+编辑修复):N3337 HTML, PDF

c++ 14(+编辑修复):N4140 HTML, PDF

c11n1570(文本)

C99 N1256

标准草案在批准和出版前分发征求意见。 请注意,工作草案不是当前生效的标准,也不是确切的已发布标准


ANSI C标准草案(又名C.89)的文本可在网上获得。这是在ISO C标准(C.90)接受之前由ANSI委员会标准化的,所以章节的编号不同(ANSI章节2到4大致对应ISO章节5到7),尽管内容(应该)基本上相同。


虽然不是一个实际的标准,但ISO C (C89/90)有一个修正案,称为C94/95,或规范附录1。它被集成到C99中,尽管Clang等编译器允许您在命令行上指定-std=c94。ISO/IEC 9899:1990/Amd 1:1995可以从SAI GLOBAL以高价购买(PDF或硬拷贝)。

http://clc-wiki.net/wiki/The_C_Standard

该文件的摘要可以在这里找到。

When the (then draft) ANSI C Standard was being considered for adoption of an International Standard in 1990, there were several objections because it didn't address internationalization issues. Because the Standard had already been several years in the making, it was agreed that a few changes would be made to provide the basis (for example, the functions in subclause 7.10.7 were added), and work would be carried out separately to provide proper internationalization of the Standard. This work has culminated in Normative Addendum 1. Normative Addendum 1 embodies C's reaction to both the limitations and promises of international character sets. Digraphs and the header were meant to improve the appearance of C programs written in national variants of ISO 646 without, e.g., { or } characters. On the other end of the spectrum, the facilities connected to and extend the old Standard's barely adequate basis into a complete and consistent set of utilities for handling wide characters and multibyte strings. This document summarizes Normative Addendum 1. It is intended to quickly inform readers who are already familiar with the Standard; it does not, and cannot, introduce the complex subject matter behind NA1, nor can it replace the original document as a reference manual. (Nevertheless, it tries to be as accurate as possible, and its author would like to hear about any errors or omissions.)

http://www.lysator.liu.se/c/na1.html