Is there something like the official C documentation? [closed] - c

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I'm looking for the documentation of all the syntax and built-in functions in C, but I can't find any site online which seems like an ultimate official source of standard C knowledge.
Apart from the famous book by Kernighan and Ritchie, isn't there any online C specification? Maybe there is, and I don't know how to find it. Or maybe the problem is that I don't exactly know what I'm looking for.

You can obtain a PDF copy of the C99 standard (ISO/IEC 9899:1999) from ANSI (and other fine standards organizations) for your private use for a modest fee - I believe it was 18 USD when I bought mine. Having that available is invaluable to me. But if you find a copy in public, then it is contraband.
You can find final committee drafts and current working documents of the C (C0x) Standard Committee at the JTC1, SC22, WG14 web site at the Open Standards Organization. (That's Joint Technical Committee 1, Sub-Committee 22, Working Group 14, I believe).
There is also a hardback book 'The C Standard: Incorporating Technical Corrigendum 1' (also including the Rationale) available for a slightly less modest 85 USD or thereabouts.
One of the best books about C is 'C: A Reference Manual' in its fifth edition. However, you asked for 'ultimate official source of standard C knowledge', and the only 'official' such source is the C standard, plus its corrigenda.
See also the material at http://www.coding-guidelines.com/ and http://c0x.coding-guidelines.com/.

There is this online website devdocs
They have multiple API documentations which are well organized. It is free and open-source.
For c doc click this link http://devdocs.io/c/

The official C99 standard is available for purchase from your national standards body; however, in practice everyone reads the draft with post-1999 corrections/amendments included, which you can download for free:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf

Strictly speaking, the C standard is not available for free. You need to purchase an electronic copy from http://www.ansi.org/ or http://www.iso.org.
However, you can download a free draft version from the Open Standards Organization's website - this is as good as or better than the official standard itself. It incorporates information from the ISO C99 standard plus three Technical Corrigenda, all of which are official ISO documents.
More info here: http://c-faq.com/ansi/avail.html

Is there something like the official C documentation?
The most official documentation is the ISO standard, to which compilers are written and are expected to interpret correctly.
C99 Standard
Here's the latest Committee draft on the C99 Standard, last updated April 12, 2011:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
I'll try to keep it up to date with the latest version as I can.
Kernighan & Ritchie
I also found K&R's text, second edition, here: http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf
However, I'd use the -Wall flag when compiling the examples in the book so that you don't get led too far astray by the age of the text.

C is an ISO standardised language. Current specification is ISO/IEC 9899:1999 standard a.k.a. C99.

You can refer GNU C documentation at https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html
Specifically, this manual aims to document:
The 1989 ANSI C standard, commonly known as “C89”
The 1999 ISO C standard, commonly known as “C99”, to the extent that C99 is implemented by GCC
The current state of GNU extensions to standard C

There're various C standard specifications.
See C's history on wikipedia for example.
When we talk about standard C these days, we mostly refer to the ANSI C Standard.
Here's a link to the standard in textform:
http://flash-gordon.me.uk/ansi.c.txt

Look at The New C Standard: An Economic and Cultural Commentary.

If what you want is the documentation for the standard library functions, then P.J. Plauger's "The Standard C Library" http://www.amazon.com/Standard-C-Library-P-J-Plauger/dp/0131315099/ref=sr_1_1?s=books&ie=UTF8&qid=1290273108&sr=1-1 is the best reference. It's got pretty extensive annotation and comentary on the why and how of the standard.

https://msdn.microsoft.com/en-us/library/fw5abdx6.aspx
The "C Language Reference" describes the C programming language as implemented in Microsoft C. The book's organization is based on the ANSI C standard with additional material on the Microsoft extensions to the ANSI C standard.

Related

Are there any plans for a future C standard after C11?

I searched on the open standards website, particularly the C working group homepage but only found information about C11.
They seem to have regular meetings and discuss different features and extensions, but they never actually mention a future C standard nor roadmap. It is hard to tell whether they are working on a new standard or just a Technical Corrigendum to the current standard.
I sent an email to the guy on the WG 14 contact section but I didn't expect to get an answer anytime soon, however, I did.
This is what he replied to me:
the Committee has not discussed starting work on a new revision of the
Standard. WG 14 will be meeting in Parma Italy the first part of
April, and so far there as not been any proposals for new features
that would prompt the revision process.
Thanks,
John Benito - ISO/IEC JTC 1/SC 22/WG 14 Convener
So I guess this is as official as it gets for now.
It appears there is discussion about the next C standard, C2x, and there are proposals as well.
You can view the charter here.
And, you can view the email list here.
At the bottom of the charter, it indicates an expected publication date of 2022.
There is C18 (https://www.iso.org/standard/74528.html) standard released in June 2018 but it only addressed flaws in C11 without introducing new language features.
A technical corrigendum is issued to correct a technical error or ambiguity. New features and extensions need to be published as an amendment or revision of the standard.
See here for an in depth description of the procedure for developing an international standard:
http://isotc.iso.org/livelink/livelink?func=ll&objId=4230452&objAction=browse&sort=subtype

What is the difference between C, C99, ANSI C and GNU C?

I have started programming practice on codechef and have been confused by the difference between C and C99. What does C mean here? Is it C89? Check the languages at the bottom of this submit. It contains both C and C99.
I found on the internet something called GNU C. Is there a different C for linux/unix systems? Are these compliant to the C standards by ANSI? I have also read in some places "C99 strict". What is this?
Are there any other different standards of C in use? Is there something called C 4.3.2 or is it the gcc version in current use?
EDIT:
This, This, This helped. I'll search more and edit the things that are left unanswered.
I am not a programming newbie. I know what C language is. I know that there are the different C standards by ANSI like C89, C99 and C11.
Everything before standardization is generally called "K&R C", after the famous book (1st edition and 2nd edition), with Dennis Ritchie, the inventor of the C language, as one of the authors. This was "the C language" from 1972-1989.
The first C standard was released 1989 nationally in USA, by their national standard institute ANSI. This release is called C89 or ANSI-C. From 1989-1990 this was "the C language".
The year after, the American standard was accepted internationally and published by ISO (ISO 9899:1990). This release is called C90. Technically, it is the same standard as C89/ANSI-C. Formally, it replaced C89/ANSI-C, making them obsolete. From 1990-1999, C90 was "the C language".
Please note that since 1989, ANSI haven't had anything to do with the C language, other than as one of many instances working on the ISO standard. It is nowadays done in USA through INCITS and the C standard is formally called INCITS/ISO/IEC 9899 in USA. Just as it is for example called EN/ISO/IEC in Europe.
Programmers still speaking about "ANSI C" generally haven't got a clue about what it means. ISO "owns" the C language, through the standard ISO 9899.
A minor update was released in 1995, sometimes referred to as "C95". This was not a major revision, but rather a technical amendment formally named ISO/IEC 9899:1990/Amd.1:1995. The main change was introduction of wide character support.
In 1999, the C standard went through a major revision (ISO 9899:1999). This version of the standard is called C99. From 1999-2011, this was "the C language".
In 2011, the C standard was changed again (ISO 9899:2011). This version is called C11. Various new features like _Generic, _Static_assert and thread support were added to the language. The update had a lot of focus on multi-core, multi-processing and expression sequencing. From 2011-2017, this was "the C language".
In 2017, C11 was revised and various defect reports were solved. This standard is informally called C17 or C18. It was finished in 2017 (and uses __STDC_VERSION__ = 201710L) but was released by ISO as 9899:2018, hence the ambiguity between C17/C18. It contains no new features, just corrections. It is the current version of the C language.
A draft called "C23"/"C2X" is work in progress by the committee, planned to be released in 2023. The current working draft can be found here, at this point called N2731, last changed 2021-10-18.
This contains a lot of minor defect report fixes like C17/C18 but also some major changes, most notable (so far):
the removal of exotic signedness representations in favour of mandatory 2's complement
final removal of "K&R-style" function definitions (flagged obsolescent since C99)
some new functions added including memccpy and strdup
some new function attributes from C++ deprecated, fallthrough, maybe_unused, and nodiscard
binary 0b notation for integer constants (currently not listed as one of the changes to N2731 but present on p.51 of the draft).
"C99 strict" likely refers to a compiler setting forcing a compiler to follow the standard by the letter. There is a term conforming implementation in the C standard. Essentially it means: "this compiler actually implements the C language correctly". Programs that implement the C language correctly are formally called strictly conforming programs. Such programs may also not contain any form of poorly-defined behavior.
"GNU C" can mean two things. Either the C compiler itself that comes as part of the GNU Compiler Collection (GCC). Or it can mean the non-standard default setup that the GCC C compiler uses. If you compile with gcc program.c then you don't compile according to the C standard, but rather a non-standard GNU setup, which may be referred to as "GNU C". For example, the whole Linux kernel is made in non-standard GNU C, and not in standard C.
If you want to compile your programs according to the C standard, you should type gcc -std=c99 -pedantic-errors. Replace c99 with c17 if your GCC version supports it.
I MUST respond regarding ANSI C. Although ANSI has not done anything with it, compilers are still built to it. PIC XC16 compiler for example:
"The compiler is a fully validated compiler that conforms to the ANSI C
standard as defined by the ANSI specification (ANSI x3.159-1989) and
described in Kernighan and Ritchie’s The C Programming Language (second
edition). ..."
Not all programming is for "big" computers like PCs. Writing a compiler for your device costs, and validating costs time & $. ANSI C is alive & well &
living in your embedded / real-time devices.
ANSI C :
The first C language was standardized by the body called ANSI in 1989 that's why it is called c89.
C99 :
with the demand from the developers requirements, in 1999-2000 further or additional keywords and features have been included in C99 (ex: inline, boolean.. Added floating point arthematic library functions)
GNU C: GNU is a unix like operating system (www.gnu.org) & somewhere GNU's project needs C programming language based on ANSI C standard. GNU use GCC (GNU Compiler Collection) compiler to compile the code. It has C library function which defines system calls such as malloc, calloc, exit...etc
ANSI C is a standard which is being used by or refereed the other standards.
In Addition To Lundin Answer
Here is What Dennis Richie Has To Say When Asked
"Why didn't K&R wait for the final, approved ANSI standard before writing K&R 2nd edition?"
Why didn't K&R wait for the final, approved ANSI standard before writing
K&R 2nd edition? It seems like this book will only be the correct standard for
a few months before it will be supesceded by the final ANSI standard. I know
that there are likely to be few major changes at this late stage, but why not
wait a few months and make sure you get it 100% right, rather than needing to
almost immediately write a 3rd edition or be obsolete?
We thought it would be nice to mark the 10th anniversary
of the first edition.
More seriously, we started work last summer because we had the
time and inclination then, and it appeared that X3J11 was approaching
an end. In December and January, as we were finishing, we considered
whether the possibility of important changes warranted putting off
delivery, and (after discussing the matter with the publisher)
decided that it was not worth waiting. P-H wanted it, and both
Brian and I wanted it off our agendas.
Even if there are changes in the standard, it's hard to imagine
that they would be extensive enough to warrant a new edition.
(We were even prepared to cope somehow with noalias, if it had lasted.)
We're ready to make necessary changes in a future printing,
but there's reason to hope that they should be minor. X3J11's
members are very anxious to finish without surprising people, too;
many of them work for companies that are preparing ANSI compilers,
after all.
Dennis Ritchie
This question was not thoroughly searched on net for answer ,anyway you may look at this :
C is a general-purpose programming language initially developed by
Dennis Ritchie between 1969 and 1973 at AT&T Bell Labs.
C99 is a standard of the C language published by ISO and adopted by ANSI in around 1999.
GNU C is just an extension of c89,while some features of c99 are also added,but in entirety it is different from c99 standard so when compiling in gcc we have to enter -std=c99 which is already mentioned in the other answers.
ANSI C is a successive series of standards released by ANSI.

Where can I find the C specification? [duplicate]

This question already has answers here:
Where do I find the current C or C++ standard documents?
(11 answers)
Closed 3 years ago.
I am in the situation where I may have the opportunity to teach C to some students. The University wants to teach them pure c, not c++, to keep the advanced c++ course separate.
Since c++ is derived from c, is there an official "c rulebook" which contains all the features of c, but none of the c++ features? The reason I want to know is so I can look up what I need to teach the students.
I once saw a (2000 page?) manual on the c++ standard. Does such a thing exist for c, even if it is 20/30 years old by now?
Regards,
Ed
EDIT: I should point out I know C/C++ quite well having been teaching myself for 3 years. The only thing I don't know is what things are "officially" C and what things are "officially" C++. This is what I aim to learn so I can give the other students a better education than I could give myself.
There have been 3 official ISO C standards, published in 1990, 1999, and 2011. There have also been several "Technical Corrigenda", official documents making corrections to the standards.
The standard itself can be purchased in PDF (or paper) format from ISO or from your national standards body, such as the US ANSI. ANSI sells the C11 standard for about $30, but with strict licensing requirements. The Technical Corrigenda are available by themselves at no charge, but they're not useful without the standard. If you want to make the standard available to your class, that's probably not a practical way to do it.
But drafts of the C standards are often made available on the ISO C committee's site.
N1256 is a draft of the C99 standard with the three Technical Corrigenda merged into it. It's actually better for most purposes than the official C99 standard.
N1570 is the most recent (as far as I know, as I write this) draft of the 2011 ISO C standard, published before the ISO standard was released. There are only a few minor editorial differences between N1570 and the official standard.
There's also a small Technical Corrigendum to the C11 standard, containing a couple of fixes that aren't in either N1570 or C11: due to an oversight, the published standard didn't define the value of __STDC_VERSION__ and the optional __STDC_LIB_EXT1__ macros properly (both are 201112L).
Each standard (and draft) has a summary of the differences between it and the previous standard.
Apart from the standard (which is not really written for general programmers), Harbison & Steele's C: A Reference Manual is a very good reference. The current 5th edition covers C90 and C99, but not C11. (I don't know of any plans for a 6th edition.)
You're looking for a C standard. Since the standards bodies fund themselves through the sale of standard publications, you can't get the final version. However, there are many copies of C draft standards out there which are good enough for your purposes.
https://www.google.com/search?q=c+draft+standard+pdf
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf

Documents about C language specs

I'm wondering about the difference between what is defined by the several standards of the C language and the things that every compilers implements in a different way from the others, i want to really understand what the official specs of the C language are: there are some official docs?
I'm looking for technical stuff, not a thread on the internet, some good pdfs maybe; something that can describe everything happens with the memory management, the allocation, the lenght and the encoding of the variables, etc etc ...
I have the official manual from K&R but it's not really about what i am interested to, it's more on the "programmer side" i want something more technical and affermative.
PS
the C language have an official website for reference?
Check this
"Obtaining the Standard
Neither the Standard nor its amendments are available free of charge, although its drafts, rationales, technical corrigenda (TCs) and defect report responses are.
The Standard can be purchased in hardcopy and/or downloadable digital format from national affiliates as described on the WG14 website. Two such national bodies are ANSI - through its eStandards Store - and SAI Global (originally Standards Australia) which sells all of the ISO C Standard publications. One international source is Techstreet.
Listed below are direct links to pages for purchase or free download of the Standard, its TCs, amendments, drafts, rationales and defect report responses for each version of the Standard. The set of documents is comprehensive whereas the list of sources obviously is not."
Tried to add this as a comment but the URL would not take.
Try: http://www.deitel.com/Default.aspx?tabid=204 for details on C. I also suggest you dig up GNU's big document on C as they do some things differently and it can be important to understand GNUs way of doing things. http://gcc.gnu.org/onlinedocs/.

Where can I read C99 official language standard manual/reference/specification online? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Where do I find the current C or C++ standard documents?
Where can I read C99 official language standard manual/reference/specification online?
The standard itself is here(a) (with TC1, 2 and 3 included), the rationale document is here.
(a) Actually, it's the final draft but is still useful because:
the changes from final draft to published standard are usually minimal to none; and
it's free unlike the actual standards :-)
The official standard should not be available online — ISO and its national standards bodies would be unhappy about that. You can obtain an official electronic copy from the ANSI store (http://webstore.ansi.org/) for $18 $30 (or thereabouts — it was $18 when I obtained the C99 standard, but that was quite a while ago now; it was $30 for the C11 standard). Or you can go to the web site linked in other answers (and via Wikipedia) — namely http://www.open-std.org/jtc1/sc22/wg14/ - and obtain almost official copies of the standards documents.
Wikipedia links directly to it.
Here's the link to the standard N897 C Standard Rationale and here's the full documentation N1124 as set down by ISO committee, here's a wiki detailing about the standards

Resources