2

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.

FreelanceConsultant
  • 13,167
  • 27
  • 115
  • 225
  • The book here http://www.amazon.com/gp/product/0131103628/ref=oh_details_o00_s00_i00?ie=UTF8&psc=1 – Chris Loonam May 04 '13 at 17:28
  • K&R pointed by Chris and the [standard](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf) – David Ranieri May 04 '13 at 17:30
  • And the nice HTML-ized versions of the spec: http://port70.net/~nsz/c/c99/n1256.html (1999) or http://port70.net/~nsz/c/c11/n1570.html (2011). – R.. GitHub STOP HELPING ICE May 04 '13 at 17:31
  • 20-30 years old? C11 isn't even two years old! – Carl Norum May 04 '13 at 17:32
  • 3
    As an aside - C++ may have originally been derived from C, but the two have diverged in some significant ways since then. Teaching only the common subset is probably doing the students a disservice. – Carl Norum May 04 '13 at 17:36
  • 3
    Learn your subject before trying to teach it. – n. m. could be an AI May 04 '13 at 17:36
  • 1
    @n.m. I'm a student and I've been teaching myself for probably 3 years now. I am nearly an expert, and the reason I am asking for this information is to teach my students even better than I can teach myself. – FreelanceConsultant May 04 '13 at 17:41
  • @EdwardBird Don't worry you are on the right track , not many care to familiarize themselves with documentation of any C standards , its apparent that you are keen on learning both for yourself and for the sake of your students... – Barath Ravikumar May 04 '13 at 18:14
  • @BarathBushan Thanks, it's learning for the sake of learning really. I could give a course in general C/C++ but I think that would be a lazy thing to do, and then the advanced course wouldn't make any sense either! – FreelanceConsultant May 04 '13 at 18:19
  • 1
    "I am nearly an expert" — you might be an expert but you are asking what I deem a novice level question. Any half-competent C programmer ought to know what major versions of the C standard exist and how they differ. Maybe not in detail but they should possess least some general knowledge of the subject. – n. m. could be an AI May 04 '13 at 18:45
  • @n.m. And I agree with you -- why do you think I asked this question? Because I want my students to know! – FreelanceConsultant May 04 '13 at 20:26
  • 4
    I suggest you drop the term "C/C++" from your vocabulary, especially when teaching students. C and C++ are two closely related but quite distinct languages. In particular, most valid C code is valid C++ code, but most well-written C code is *not* well-written C++ code. – Keith Thompson May 04 '13 at 20:30
  • @KeithThompson I intend to make it quite clear we are focusing on C. – FreelanceConsultant May 04 '13 at 20:32
  • I apologize for comments that offended you. – n. m. could be an AI May 04 '13 at 20:57
  • 1
    Also when teaching your students, you shouldn't tell them the urban myth that C++ is derived from C. For modern C that is simply not true. Both languages emerged in parallel and had a mutual influence on each other and in particular C++ is not a superset of C. – Jens Gustedt May 04 '13 at 22:40

2 Answers2

7

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.)

Keith Thompson
  • 254,901
  • 44
  • 429
  • 631
4

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

NovaDenizen
  • 5,089
  • 14
  • 28
  • Don't forget the C11 draft: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf – Carl Norum May 04 '13 at 17:35
  • 1
    @KeithThompson “To be precise,” N1124 is a draft from shortly after C99TC2 became official, whereas N1256 is a draft from shortly before C99TC3 became official. For some reason it comes up first in Google searches if one is not careful. It is only useful when one needs a freely available approximation of C99TC2. – Pascal Cuoq May 04 '13 at 21:57
  • @PascalCuoq: Right. N1124 was the best version available until N1256 came out; that's probably why it still shows up in search results. – Keith Thompson May 05 '13 at 00:05