Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does "ANSI C" or "ANSI C++" still mean something today?

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?

like image 495
user1849534 Avatar asked Jan 03 '13 15:01

user1849534


3 Answers

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.

like image 130
Steve Jessop Avatar answered Sep 18 '22 23:09

Steve Jessop


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

like image 31
ouah Avatar answered Sep 18 '22 23:09

ouah


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).
like image 41
Matteo Italia Avatar answered Sep 18 '22 23:09

Matteo Italia