13

After having an answer here wrong, because I wasn't up to date on the C standard, I started to look for some place that gives a description of whats in the C and C++ standards.

I do not want the complete standards, of which I found links in Where do I find the current C or C++ standard documents?, or intimate technical discussions. Instead I would like something that briefly describes the standard, with references to the actual standard if I want to check it more thoroughly, and maybe saying which standard the feature was introduced in.

Is there such a resource available?

EDIT: A little background to the question: I have been programming C for over 20 years now, and when I learnt it not much was standardized. And what was in the official standard was not widely implemented. Through the years I have become good enough C programmer that my friends and colleges come to me for help when they have problems.

However, when I learned C I was told that things like memory layout for multi-dimensional arrays was implementation specific, and when I saw a question about that subject I said that it wasn't standardized only to be told I was wrong. But even knowing this, I have a hard time finding any place saying that it's in the standard, and it's even harder to find in which standard it was first introduced.

If there was some place saying "Memory layout of multi-dimensional arrays was standardized in C9x, in section Y of the standard document" It would have been easy to find and give this to the person asking the question. I am not intrested in what the actual layout is, just that it has been standardized, and where to look if I really want a definitive answer about it.

This of course goes for other things. Like knowing that header file "<yyy.h>" is mandated by standard "C90", and where in the standard I should look for the rationale and contents of it. It is very difficult to find these things when they are spread out, having it collected in one place would make it much easier to find.

Community
  • 1
  • 1
Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
  • Interesting question, but in all my time reading and learning about C++ from books and online, I have never run into such a thing, so I consult the standard if I need to really provide definitive proof of something. There is a lot of standards compliance discussion on this site, and in the c++ newsgroups (comp.lang.c++ and its moderated cousin), but it's distributed rather than, say, a `C++ Standard, Abridged and Annotated` like you'd want. – wkl Nov 11 '11 at 07:00
  • if you mean you want a document that explains how to write 100% standard compliant code, and a document that lists what the standard consists of, I'm with you compeletely – marinara Nov 11 '11 at 07:02
  • 1
    "I am not intrested in what the actual layout is, just that it has been standardized, and where to look if I really want a definitive answer about it." The only _definitive_ answer will be found in the standard; everyone else is a copy or simplification of that. And most simplifications are interested less in when something was standardized than in how to _use_ it. So generally, what you're looking for simply doesn't exist, because most people don't care. – Nicol Bolas Nov 11 '11 at 08:19
  • 1
    @NicolBolas But how would you know where _find_ the definitive answer, if there is nowhere that points to it? Like in the example about array layout, even reading [WG14 N1256](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf) (which is the latest C standard publication) it was hard to find. It's not in the contents, it's not in the index. It hides in a paragraph of a sub-section of "Postfix operators", which would be the first place I would think about looking for something like that. – Some programmer dude Nov 11 '11 at 08:37
  • 1
    Would NOT be the first place to look, I mean in my comment. – Some programmer dude Nov 11 '11 at 10:00
  • 1
    The new C++ standard is actually a joy to read, so I'd be hard pressed to suggest anything else in preference to it. It's long, but it's extremely well presented, clean and precise. The C99 standard, on the other hand, is not terribly long, so you might as well go straight to the source there as well. – Kerrek SB Nov 11 '11 at 11:31

5 Answers5

6

Anything that's not the standard will either be not definitive, or be simplified in such a way as to be far less than useful. And anything definitive or really useful will basically be the standard.

I know of no resource that covers every section of the C standard (or even a sizable number of them) in a simplified way and I would doubt its usefulness. You generally have a specific issue you need solved and, in that case, you would search for that specific issue - the vast majority of people don't need the standard, especially when they have a resource like SO at their fingertips.

If you're a language implementer or enjoy examining the dark corners of the language in excruciating detail, then yes, get the standard, it's invaluable. If you're just using the language day-to-day (even as an expert), you can get by without it, with just a bit of googling (a).


(a) Make sure one of the search terms is site:stackoverflow.com :-)

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
6

I found http://en.cppreference.com/w/cpp is now becoming pretty good! (always much more complete)

Emilio Garavaglia
  • 20,229
  • 2
  • 46
  • 63
1

There is so much material in the standard there is just no way to briefly describe it. I don't think your question is really answerable as written. If you want a reference for the standard library though, Josuttis' book http://www.amazon.com/Standard-Library-Tutorial-Reference/dp/0201379260/ref=sr_1_1?ie=UTF8&qid=1320994652&sr=8-1 is always a fantastic reference.

Mark B
  • 95,107
  • 10
  • 109
  • 188
1

I'm guessing you already are familiar with the older standards and want to brush up on the newer less-used stuff.

Here is a good read for C99. It covers changes and has notes to the actual standard. Also some stuff on C++ in there.

Wikipedia is great for C++11. Great for basics, but doesn't go into full detail.

If you fully understand the language then you can generally infer the standard. For strange corner-cases you're going to have to refer to the standard.

Pubby
  • 51,882
  • 13
  • 139
  • 180
  • I wouldn't call that a good read about C99, it is very shallow and excludes a whole lot of changes: restrict keyword, designated initializers, variable length arrays, stdint types, bool type, extended wide character support etc etc. – Lundin Nov 11 '11 at 07:20
0

I think some of the other people answering this question are right: one seldom needs the ultimately authoritative ISO standard document, unless you are writing a compiler or something like that. For me, I find that the main books on the two languages by the language creators are sufficient for almost all my needs. They are:

The C Programming Language by Brian Kernighan and Dennis Ritchie

The C++ Programming Language by Bjarne Stroustrup

Look for the latest editions of each, although a quick search on Amazon shows neither updated for the latest incarnations of the languages (C99 and C++11). You might need to supplement with online sources, or perhaps look at A C Primer Plus and Professional C++.

Randall Cook
  • 6,728
  • 6
  • 33
  • 68