문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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

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).
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top