Looking for C/C++ language and standard libraries specifications [duplicate] - c++

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Where do I find the current C or C++ standard documents?
I have several C books, and one of them, C by Discovery, explains the language very well. But so far I don't seem to have been able to find the full C/C++ language and library standards and lists of functions, types, etc., in whole detail.
Where is exactly a full standard for C99 and also the older, supposedly more commonly used and accepted, C language standards, the C++ language standards, and their libraries?
Is there some of them I must pay for, or should I just follow what Wikipedia and documentation like that of GCC cite?
Where else should I go to download or get them fully?

The Wikipedia article C99 has a link at the bottom to a draft of the C99 language specification. It is a draft because the final published version you have to pay for. But the draft is basically accurate, so it's a good reference. This is an extremely long specification of the entire language including the library, but possibly not what you are after. To just see the standard library, simply consult the man pages. Consult the Wikipedia article C standard library for a list and summary of the various functions.
For C++, the same deal. The Wikipedia article C++ has links to various drafts of the complete specification, notably the most recent draft of C++ from 2010 (the old C++, before C++0x comes into effect). The Wikipedia article C++0x has similar links to drafts of the soon-to-be-named C++ 2011 standard. But if you are just looking for a reference on the standard library, you can't go past cplusplus.com's reference section, which includes full documentation for the C library (in C++ mode), the IO library, and the STL (containers and other misc utilities). That's what I use as a day-to-day library reference.

The best online copy of C99 I've found is here:
http://busybox.net/~landley/c99-draft.html

If you want the actual standard, I don't think you can just download it. I believe you have to buy a copy from the American National Standards Institute. The GCC documents don't provide all the detail you need for the base language that GCC extended.

Related

Which PDF of the C++ ISO standard should I read? [duplicate]

This question already has answers here:
Where do I find the current C or C++ standard documents?
(11 answers)
Closed 9 years ago.
Sometimes, I want to search answers from the C++ standard by myself. Reading standards might help me get an overview of the language principle proposed.
By searching the internet, I was confused by flooding C++ forums and helper websites. They provide all kinds of PDF files for reading.
I don't know which PDF file and/or which version should I adopt.
I found several websites:
JTC1/SC22/WG21
Standing Documents
I wonder whether there is a single site where the standard is posted. Which version should I refer to when solving problems? Some says C++98, while other say C++11, and even the latest working drafts. (many drafts confusing me).
EDIT
I found a useful information from The Standard, which writes:
Except only for the final standards/reports, all C++ committee
documents are freely publicly available, including all working drafts,
many of which closely approximate the published standard. The January
2012 working draft contains the C++11 standard plus minor editorial
changes.
The January 2012 working draft is N3337.
Hope this help you guys.
EDIT
From Wiki C++11, it writes:
The working draft most similar to the published C++11 standard is N3337, dated 12 January 2012; it has only editorial corrections from the C++11 standard.
2018 Update: The C++ standard is maintained on GitHub. You can find an archive of old working drafts here that goes back a few years.
The official C++11 standard INCITS/ISO/IEC 14882:2011 is available at ansi.org for $30. You can Google older standards by searching for e.g. 14882:2003 and looking for PDFs. I'm not sure if it's "legal" to download them, so be sure to feel bad about it if you do so.
Before a standard is published, the committee maintains a Working Draft of the standard document with all the revisions as they introduce them. That Working Draft is eventually voted to become a standard, after which only minor editorial changes are made before it is published as a standard.
The working drafts - and quite a few other papers - are released as a numbered series of documents by the committee and are publicly available except for the final approved draft of the standard. ISO rules keep the last revision "secret" so that people will pay for the standard and that money can be used to fund the organizational work the actual ISO does.
People who don't want to pay for the standard use the final public copy of the working draft as a reference, as it is generally identical to the standard document modulo the minor editorial changes I mentioned earlier. For C++11, that last draft is N3242 - Working Draft, Standard for Programming Language C++. The first working draft after C++11 N3337 may more correctly reflect the final standard (I'm too lazy to compare).
The current Working Draft for C++1y is N3690 - Programming Language, C++. If you're really hardcore, you can track the editor's repo of the current draft at Github.
The official ISO standard for C++11 is ISO/IEC 14882:2011, and official ISO standard for C++03 is ISO/IEC 14882:2003. You usually need to pay to get a copy of these (and to the best of my knowledge that's the only legal way to do so), and these are the official documents.
C++98 is an older version of the language that was superseded in 2003 with C++03, which was mostly minor bug fixes and adjustments to the document. C++11 is the newest C++ standard and was released in 2011. Compiler support is still in-progress. The drafts that you're referring to are draft versions of the standards that are periodically released, which may differ from the final published version. Working papers are mostly proposals for the documents that are considered by the ISO group, but which are not official.
Hope this helps!
Well, you can buy the official standard from ISO (as you've linked). The latest working drafts are sufficient for my purposes (I'm not implementing compilers, linkers, libraries or lexers).
If you're doing serious professional work with the language it's worth paying for. If you're looking to understand the specific technical details of the language, use one of the drafts.

C++ standard documentation [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Where do I find the current C or C++ standard documents?
After reading several websites and books, I notice there is a constant reference to a C++ standard. While reading posts on stackoverflow and c++ forums, the communities encourage following this standard. This encouraged me to Google c++ standard to find out in more detail about the language. Is the standard a book? a published document? a mystic spirit that speaks through some seemingly crazed medium? Is there a single source and a final version that people refer to for verification? Several sites and books claim to be based off the standard, but this is not the same as the standard.
So far, I have found recommendations to look at the ISO standard (which seems to be mostly incomplete drafts) and the GNU c++ documentation at http://gcc.gnu.org/onlinedocs/libstdc++/. I have briefly used these to try to answer some of the questions that come to mind, but I want to make sure these are the proper references to use when answering questions (my own or others) and that I do so according to the proper standard and not something based on the standard (there is a difference).
Just to note:
For me, 99% of all my programming will be done in a Linux environment so there may (or may not be) a different standard for different operating systems
There is a single version of standard. There is no difference between systems( it is one standard). You have to pay go get full version of the standard ( even for PDF file). Everyone is using:
https://github.com/cplusplus/draft [EDITED TO THE NEWEST VERSION]
for free, because it is draft version and it is free. There are some different between draft and released one.
If you want to get a copy of the standard, you can buy it for a small fee from ISO, which is how they fund themselves.
However, if you simply follow the last draft of C++11, which is currently the latest C++ standard, and will remain to be for some time, you will never notice a difference against the released standard.
It is a similar story with POSIX, a standard used for UNIX-like APIs on that family of operating systems. In that case you would want to go here.
However, while a perfect understanding of C++ is highly desirable whatever you do, it may well be that your portability needs will make POSIX somewhat irrelevant to you; either you might only need Linux compatibility, or you might restrict yourself to APIs (such as the standard C++ library or other portable libraries) that will support you even on non-POSIX operating systems.

new version of c++

Is there going to be a new version of C++ and when?
The creator of C++ C++0X FAQ:
http://www2.research.att.com/~bs/C++0xFAQ.html
Question: When will C++0x be a formal standard?
But C++ 0X does exists in some degree in various compilers. See both:
Question: When will compilers implement C++0x?
GCC C++ 0X support
To see what C++ 0X will be like, look at the wiki:
Wiki C++ 0X
The C++0x is the unofficial name for the new C++ Standard which is intended to replace C++03 standard (published in 2003). The final draft of the international standard is due in March of 2011. However this does not mean you will be able to use the new features straight away as the standards will have to be implemented by compilers and the completeness of these implementations will vary.
You can find a draft of the new standard here:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3092.pdf
However you can use the Technical Release 1 libraries which include a fair deal of functionality that will appear in the new standard which you can find here:
http://en.wikipedia.org/wiki/C%2B%2B_Technical_Report_1
If you are looking for the status of the C++ox implementation in GCC (which is a free compiler) see this link:
http://gcc.gnu.org/gcc-4.5/cxx0x_status.html
Here is a link to a really detailed FAQ that provides a lot of additional information:
http://www2.research.att.com/~bs/C++0xFAQ.html
However, the experience shows that the complete implementation of a freshly released standard, takes years... If one considers the complexity of the recent additions, I am very pessimistic about getting cross-platform compliant implementations soon.

Is there a standard C++ grammar?

Does the standard specify the official C++ grammar?
I searched, but did not find it anywhere.
Also, I wish to read a bit about C++ grammar in detail, like which category of grammars it falls in, etc. Any links pointing me in the right direction would be helpful.
By category, I mean
taken from here.
Yes, it does.
The grammar is described in detail throughout the standard and is summarized in Appendix A: Grammar Summary (it's Appendix A in both the C++03 standard and the C++0x final committee draft).
You can purchase the C++03 standard or you can download the C++0x FCD (it's document n3092 on that page).
To answer the "what category is it in?" question, the C++ grammar is not context-free (also see the questions linked in answers to that question; they have additional examples of issues related to the C++ grammar and parsing C++).
Alessio Marchetti put a hyperlinked BNF grammar for C++ up at http://www.nongnu.org/hcb/.
Having everything linked together and on a single page makes it easy to navigate between rules.
Andrew Birkett has a thorough overview of parsing C++ on his web site. It covers some of the difficulties in creating a C++ grammar (mixing lexical, syntactic, and semantic analysis) and includes links to several C++ grammars.
Bjarne Stroustrup, the creator of C++, wrote a book called The C++ Programming Language which has been updated many times (I read the 3rd edition about 10 years ago). I recall it had very technical details regarding grammar (pre-processor and compiler).
You can probably find this book in on of your local book stores, it may offer you more enjoyment than a standards document from ANSI, depending on how specific you need to be.
Not sure but as far as I see, James McNellis's link (to the pdf) contains a note on the first page:
Warning
This document is not an ISO
International Standard. It is
distributed for review and comment. It
is subject to change without notice
and may not be referred to as an
International Standard.
So, searched and I think this is the correct link to the official ISO:
http://www-d0.fnal.gov/~dladams/cxx_standard.pdf

Where can I look at the C++ standard [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Where do I find the current C or C++ standard documents?
I want to use STL with the current program I'm working on and the vendor doesn't support what I feel is a reasonable STL, working is not my idea of reasonable. I have been unable to find a C++ Standard or an STL standard that is not just an API that leaves me wondering if my interpretation is correct or if the vendor interpretation is correct. I've already spent a great deal of time at SGI's site. Any reccomendations? Also, is there any document that's not an API that would be considered the standard?
The draft of the current C++0x standard is available from this page and the official homepage of the C++ standards committee is here.
Information on where to get the current standard document:
Where do I find the current C or C++ standard documents?
Other responses in that question have information on downloads of various drafts of the standards which can be obtained free (the actual ratified standards cannot be obtained free).
The Standard is available as a PDF for ANSI.org. ($18 last time I checked, downloadable).
$18 for a downloadable PDF was considered a breakthrough, since previously ANSI only sold it standards in hardcopy form, for several thousand dollars a copy. (Normally, ANSI standards have a very limit market -- only motorcycle helmet manufacturers are going to buy the ANSI Standard for motorcycle helmets etc), and Standard sales was the primary way ANSI financed it's operation.
Each national standards body in ISO can make the Standard available as they see fit. I'm told British Standards had made a deal to publish it in book form, but I don't know it taht ever came about.
i googled "C++ ansi standard" and clicked the first result
What's available for free on the
Internet?
The C++ standard went through two
Committee Drafts (CDs) which were made
available for public inspection and
comment. Changes made to the second CD
after the public comment period were
submitted to the member bodies for a
vote and became the official standard.
CD2 of the C++ standard is very
similar, but not exactly the same, as
the final standard.
body of a draft (see directory listing for TOC etc)
The book's ISBN is 978-0470846742, if you're interested in treeware. It's quite up to date (includes the Technical Corrigendum). You are right in suspecting it's the definitive resource when arguing with compiler vendors. The standard doesn't prescribe performance, but it does put upper bounds on the big-O complexity of many algorithms