6

Last time I checked, saying that you are coding in ANSI C was equal to say "this is C99 compliant code with nothing else in it". Now with C11 and C++11, does this distinction still remain? Does it still has some sort of meaning?

user1849534
  • 2,329
  • 4
  • 18
  • 20

3 Answers3

15

Historically "ANSI C" was used to mean "standard C", i.e. C89, by contrast with "K&R C" and the various pre-standard variants invented by compiler-writers. That's why the 2nd Ed. of "The C Programming Language" has a big red "ANSI C" stamp on the cover.

Then for a time "ISO C" was used to mean "the new standard C", i.e. C99, by contrast with "ANSI C".

This was always a confusing usage, since both ISO and ANSI ratified both C89 and C99. ISO ratified the former as C90, and published it with some layout changes from ANSI's version but supposedly the same substantial content. So "ANSI C" always was an ISO standard, and "ISO C" always was an ANSI standard. The only difference was which body oversaw the standardization process.

Following this usage (and probably encouraging it to continue), the -ansi flag to GCC is equivalent to -std=c90. It that context it actually means "C90, plus some GNU extensions that do not conflict with the standard".

I'm not aware of "ANSI C" referring to C99, but that doesn't mean it hasn't been used to mean that.

I don't think that using the term "ANSI C" has helped anyone in the last 10 years. ANSI ratified C11, but it would not be helpful to start saying, "aha! well in that case, ANSI C suddenly now means C11!". We can certainly say that C11 is the current ANSI C standard, but nevertheless the term "ANSI C" can't be used with any reasonable expectation that people will clearly understand it to mean C11.

Steve Jessop
  • 273,490
  • 39
  • 460
  • 699
  • 1
    Where the hell do you guys get to know all this from? :| – varevarao Jan 03 '13 at 17:31
  • thanks, so the best is not to use this words anymore if I have understood correctly, it's just something that can have different meaning and can only generate noise in the communication. – user1849534 Jan 03 '13 at 17:39
9

Both the ISO C11 and ISO C++11 have been ratified as the new ANSI C and C++ Standards.

For example, on my ANSI copy of C11 it is written:

Adopted by INCITS (InterNational Committee for Information Technology Standards) as an American National Standard. Date of ANSI Approval: 5/23/2012

ouah
  • 142,963
  • 15
  • 272
  • 331
5

Since currently1 3 different revisions of the C standard and "two and a half" of the C++ one are widely used, I'd say that such terminology today makes less sense than ever.


  1. Actually, at a given time there's only one "current" C (C++) standard, the last one, since it supersedes the previous versions. What I'm saying about here is that all these previous versions are still very much relevant (often more than the latest revision).
Matteo Italia
  • 123,740
  • 17
  • 206
  • 299
  • 1
    "Currently", there is only one ISO C standard and only one ISO C++ standard. All the others have been withdrawn by ISO and - as I understand it - by ANSI as well. – CB Bailey Jan 03 '13 at 15:39
  • @Gorpik well if the C++03 it's a minor update I suppose that the TR1 it's a tiny patch then – user1849534 Jan 03 '13 at 15:40
  • I suppose i can consider this 2 organizations the same organization now – user1849534 Jan 03 '13 at 15:41
  • @user1849534 That depends on your criteria. – Gorpik Jan 03 '13 at 15:43
  • @user no, you cannot. There is a reason one has "National" in the name and the other has "International" in the name. There other nations taking part in ISO. – R. Martinho Fernandes Jan 03 '13 at 15:45
  • What @CharlesBailey said, "This third edition **cancels and replaces** the second edition, ISO/IEC 9899:1999, as corrected by ISO/IEC 9899:1999/Cor 1:2001, ISO/IEC 9899:1999/Cor 2:2004, and ISO/IEC 9899:1999/Cor 3:2007." – Daniel Fischer Jan 03 '13 at 15:47
  • 1
    @CharlesBailey: ISO and ANSI may retire whatever they want, but this doesn't change the fact that C++98/03 and C89 are still the most relevant revisions in terms of written code, and very often you have to resort to them for compatibility reasons (or because compiler writers don't care - will VC++ ever move after C89?) . Also, I have yet to see a completely conforming C++11 or C11 compiler. So, "currently" *there are* 4/5 standards to keep in mind. – Matteo Italia Jan 03 '13 at 15:48
  • @Matteo: Indeed. Even if older versions are some sense technically not an ISO standard any more that makes no practical difference whatever. It can be used as though it were, and for example C++03 is still the published version of C++ that comes closest to having an implementation. Old standards don't magically cease to exist -- for that matter C++11 *refers normatively to C99*. So C++ programmers can hardly act as though C99 is somehow no longer an ISO standard, or else various standard library functions aren't defined by ISO at all ;-) – Steve Jessop Jan 03 '13 at 15:50
  • @MatteoItalia at least now that `export` is out of the way we can at least hope there will be several highly conforming implementations. – R. Martinho Fernandes Jan 03 '13 at 15:52
  • 1
    I'm not arguing with the fact that old revisions are important, but suggesting that old revisions are still "current" is a little misleading. – CB Bailey Jan 03 '13 at 15:54
  • @CharlesBailey: are not "current" for ISO, but they are "current" in practice, since the vast majority of coders still (have to) write everyday C++03 and C89 code. – Matteo Italia Jan 03 '13 at 15:56
  • Again, I'm not disagreeing; I was just pointing out a possible area for clarification in this answer. – CB Bailey Jan 03 '13 at 15:59
  • @R.MartinhoFernandes: secretly I believe that there will never be a completely conformant implementation of any C++ standard, but that's just my opinion. :) – Matteo Italia Jan 03 '13 at 16:00
  • @CharlesBailey: ok, I'll add a clarification. – Matteo Italia Jan 03 '13 at 16:01