What Is The Difference Between C, C99, ANSI C And GNU C?
-
- Home
- Questions
- Tags
- Users
- Companies
- Labs
- Jobs
- Discussions
- Collectives
-
Communities for your favorite technologies. Explore all Collectives
- Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Try Teams for free Explore Teams - Teams
-
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsGet early access and see previews of new features.
Learn more about Labs What is the difference between C, C99, ANSI C and GNU C? Ask Question Asked 11 years, 5 months ago Modified 29 days ago Viewed 119k times 178I have started programming practice on codechef and have been confused by the difference between C and C99. What does C mean here? Is it C89? Check the languages at the bottom of this submit. It contains both C and C99.
I found on the internet something called GNU C. Is there a different C for linux/unix systems? Are these compliant to the C standards by ANSI? I have also read in some places "C99 strict". What is this?
Are there any other different standards of C in use? Is there something called C 4.3.2 or is it the gcc version in current use?
EDIT:
This, This, This helped. I'll search more and edit the things that are left unanswered.
I am not a programming newbie. I know what C language is. I know that there are the different C standards by ANSI like C89, C99 and C11.
Share Improve this question Follow edited May 23, 2017 at 10:31 CommunityBot 11 silver badge asked Jun 20, 2013 at 6:21 Aseem BansalAseem Bansal 6,96214 gold badges49 silver badges86 bronze badges 4- 2 Don't forget about POSIX C :-) – pmg Commented May 22, 2017 at 9:36
- @pmg I'm a little bit confused, isn't posix responsible for regulating the unix operating system part? how does that relate to the C language? – Yuki San Commented Oct 7 at 10:50
- I can't find an objective paragraph stating "a POSIX system MUST HAVE a C compiler"... but it's pretty much (strongly) implied in the document. The POSIX rules about C are somewhere between -std=cYY and std=gnucYY (possible with the line #define _XOPEN_SOURCE 700) – pmg Commented Oct 7 at 12:27
- I mean, the POSIX language proper (read free-standing) is std=cYY; the POSIX Library is somewhere between -std=cyy and std=gnucYY – pmg Commented Oct 7 at 12:44
5 Answers
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 307Everything before standardization is generally called "K&R C", after the famous book (1st edition and 2nd edition), with Dennis Ritchie, the inventor of the C language, as one of the authors. This was "the C language" from 1972-1989.
The first C standard was released 1989 nationally in USA, by their national standard institute ANSI. This release is called C89 or ANSI-C. From 1989-1990 this was "the C language".
The year after, the American standard was accepted internationally and published by ISO (ISO 9899:1990). This release is called C90. Technically, it is the same standard as C89/ANSI-C. Formally, it replaced C89/ANSI-C, making them obsolete. From 1990-1999, C90 was "the C language".
Please note that since 1989, ANSI haven't had anything to do with the C language, other than as one of many instances working on the ISO standard. It is nowadays done in USA through INCITS and the C standard is formally called INCITS/ISO/IEC 9899 in USA. Just as it is for example called EN/ISO/IEC in Europe.
Programmers still speaking about "ANSI C" generally haven't got a clue about what it means. ISO "owns" the C language, through the standard ISO 9899.
A minor update was released in 1995, sometimes referred to as "C95". This was not a major revision, but rather a technical amendment formally named ISO/IEC 9899:1990/Amd.1:1995. The main change was introduction of wide character support.
In 1999, the C standard went through a major revision (ISO 9899:1999). This version of the standard is called C99. From 1999-2011, this was "the C language".
In 2011, the C standard was changed again (ISO 9899:2011). This version is called C11. Various new features like _Generic, _Static_assert and thread support were added to the language. The update had a lot of focus on multi-core, multi-processing and expression sequencing. From 2011-2017, this was "the C language".
In 2017, C11 was revised and various defect reports were solved. This standard is informally called C17 or C18. It was finished in 2017 (and uses __STDC_VERSION__ = 201710L) but was released by ISO as 9899:2018, hence the ambiguity between C17/C18. It contains no new features, just corrections. From 2017-2024, this was "the C language".
In 2024, a revision called C23 was released. Like previous standards, the technical content (__STDC_VERSION__ = 202311L) was finished years before ISO published it as ISO 9899:2024. The last working draft N3096 can be found here.
This contains a lot of minor defect report fixes like C17/C18 but also a lot of major changes and new features. It is a major release.
I wrote a summary of changes most likely to affect the average C programmer here: What is C23 and why should I care?
It is the current version of the C language.
"C99 strict" likely refers to a compiler setting forcing a compiler to follow the standard by the letter. There is a term conforming implementation in the C standard. Essentially it means: "this compiler actually implements the C language correctly". Programs that implement the C language correctly are formally called strictly conforming programs. Such programs may also not contain any form of poorly-defined behavior.
"GNU C" can mean two things. Either the C compiler itself that comes as part of the GNU Compiler Collection (GCC). Or it can mean the non-standard default setup that the GCC C compiler uses. If you compile with gcc program.c then you don't compile according to the C standard, but rather a non-standard GNU setup, which may be referred to as "GNU C". For example, the whole Linux kernel is made in non-standard GNU C, and not in standard C.
If you want to compile your programs according to the C standard, you should type gcc -std=c99 -pedantic-errors. Replace c99 with c17 if your GCC version supports it.
Share Improve this answer Follow edited Nov 1 at 12:32 answered Jun 20, 2013 at 9:04 LundinLundin 212k44 gold badges270 silver badges426 bronze badges 7- 13 The strict compiler setting may mean “Disable extensions; use only the C language defined by the standard” as well as, or more than, “compile correctly”. It is completely correct to accept extensions to the language; the standard was defined to allow that. – Eric Postpischil Commented Jun 20, 2013 at 12:17
- 5 There was also the C94/C95 Amendment 1 that added more wide character support, mainly. See also List of Standard Header Files in C and C++. – Jonathan Leffler Commented Jun 23, 2013 at 6:25
- 2 You write that lots of things changed from C90 to C99. Could you please name a few? – Martin Thoma Commented Mar 9, 2014 at 16:29
- 3 @Lundin you linked the wrong book for K&R; this is the second edition that describes the C89 standard. – Antti Haapala -- Слава Україні Commented Feb 22, 2015 at 11:41
- 5 Yeah, but the point is that that is not the version which defined the C programming language up to the point; not that it would be on sale anywhere. – Antti Haapala -- Слава Україні Commented Feb 23, 2015 at 7:15
I MUST respond regarding ANSI C. Although ANSI has not done anything with it, compilers are still built to it. PIC XC16 compiler for example: "The compiler is a fully validated compiler that conforms to the ANSI C standard as defined by the ANSI specification (ANSI x3.159-1989) and described in Kernighan and Ritchie’s The C Programming Language (second edition). ..." Not all programming is for "big" computers like PCs. Writing a compiler for your device costs, and validating costs time & $. ANSI C is alive & well & living in your embedded / real-time devices.
Share Improve this answer Follow answered Jan 27, 2016 at 22:29 C Is BetterC Is Better 1811 silver badge2 bronze badges 3- 1 Further, if one is doing maintenance on an embedded project which was built using a twenty-year-old compiler, it's often better to continue using the twenty-year-old compiler than to use a more recent version, even if upgrades are available, unless serious bugs have been found in the old version of the compiler and fixed in later ones. – supercat Commented Dec 9, 2020 at 17:57
- 1 If a compiler vendor switches from using a proprietary compiler design to one based on clang, and only the clang-based one supports C11 features, that would be a strong argument in favor of limiting oneself to features that were supported by the robust older compiler rather than the more "modern" one. – supercat Commented Dec 9, 2020 at 18:06
- Notably Microchip compilers are notorious for their poor standard conformance. As is K&R 2nd edition, which isn't fully up to date with "ANSI C". All modern embedded compilers support at least C11 by now. I wouldn't call the various PIC compilers modern and I would call PIC an antiquated CPU. Yes, it is still in production but the core is awful. If you are maintaining old crap, well then it is what it is, I still maintain lots of old 8 bit junk as well. But if designing new products, one shouldn't use completely outdated MCUs with completely outdated compilers. – Lundin Commented Mar 15, 2023 at 14:06
ANSI C : The first C language was standardized by the body called ANSI in 1989 that's why it is called c89.
C99 : with the demand from the developers requirements, in 1999-2000 further or additional keywords and features have been included in C99 (ex: inline, boolean.. Added floating point arthematic library functions)
GNU C: GNU is a unix like operating system (www.gnu.org) & somewhere GNU's project needs C programming language based on ANSI C standard. GNU use GCC (GNU Compiler Collection) compiler to compile the code. It has C library function which defines system calls such as malloc, calloc, exit...etc
ANSI C is a standard which is being used by or refereed the other standards.
Share Improve this answer Follow answered Jun 20, 2013 at 7:01 Kapil ChittewanKapil Chittewan 1093 bronze badges 2- Anything about C99 strict and whether the C in codechef is C89 or the earlier non-standardized original C – Aseem Bansal Commented Jun 20, 2013 at 7:07
- 1 Correction: ANSI C is an obsolete standard, which is only referred to by out-of-date documents. The C language is called ISO C, or if you will ISO/IEC 9899:2011. – Lundin Commented Jun 20, 2013 at 9:02
In addition to Lundin's Answer
Here is what Dennis Richie has to Say When Asked
"Why didn't K&R wait for the final, approved ANSI standard before writing K&R 2nd edition?"
Why didn't K&R wait for the final, approved ANSI standard before writing K&R 2nd edition? It seems like this book will only be the correct standard for a few months before it will be superseded by the final ANSI standard. I know that there are likely to be few major changes at this late stage, but why not wait a few months and make sure you get it 100% right, rather than needing to almost immediately write a 3rd edition or be obsolete?
We thought it would be nice to mark the 10th anniversary of the first edition. More seriously, we started work last summer because we had the time and inclination then, and it appeared that X3J11 was approaching an end. In December and January, as we were finishing, we considered whether the possibility of important changes warranted putting off delivery, and (after discussing the matter with the publisher) decided that it was not worth waiting. P-H wanted it, and both Brian and I wanted it off our agendas.
Even if there are changes in the standard, it's hard to imagine that they would be extensive enough to warrant a new edition. (We were even prepared to cope somehow with noalias, if it had lasted.) We're ready to make necessary changes in a future printing, but there's reason to hope that they should be minor. X3J11's members are very anxious to finish without surprising people, too; many of them work for companies that are preparing ANSI compilers, after all.
Share Improve this answer Follow edited Feb 21 at 14:47 DavidBevi 6311 bronze badges answered Feb 17, 2017 at 10:06 Suraj JainSuraj Jain 4,53630 silver badges39 bronze badges 3Dennis Ritchie
- 3 Too bad Dennis Ritchie didn't realize how aliasing rules would be used to imply that compilers shouldn't make any effort to recognize useful forms of aliasing, but instead argue that programmers whose code is broken by obtuse compilers should "thank" the compilers for showing them their code is "defective"--otherwise he could have told the people pushing such rules to make clear that refusal to support aliasing beyond the Standard's minimal requirements will make compilers unsuitable for some purposes, and low-level code's need for aliasing is not a defect. – supercat Commented May 22, 2017 at 19:38
- 1 @supercat I actually did not understand what aliasing rules means can you help me out? – Suraj Jain Commented May 29, 2017 at 11:49
- 3 The original concept was that given code like int i; int test(double *p) { i=1; *p=2.0; return i; } a compiler shouldn't be required to reload i after the write to *p on the off chance that p might hold the address of i. Perfectly reasonable. The problem is that modern compilers use the same rule to justify assumptions that writes to a long* won't affect a long long, even if both types have the same size and representation, and that even if two structures share a Common Initial Sequence, code will never use a pointer of one type to read a CIS member written via the other. – supercat Commented May 29, 2017 at 23:10
This question was not thoroughly searched on net for answer ,anyway you may look at this :
- C is a general-purpose programming language initially developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell Labs.
- C99 is a standard of the C language published by ISO and adopted by ANSI in around 1999.
- GNU C is just an extension of c89,while some features of c99 are also added,but in entirety it is different from c99 standard so when compiling in gcc we have to enter -std=c99 which is already mentioned in the other answers.
- ANSI C is a successive series of standards released by ANSI.
- I searched on net now. I edited the question. I knew about C and ANSI standards before posting the question. I am having confusion regarding specific things. I'll try to be more precise. – Aseem Bansal Commented Jun 20, 2013 at 6:58
- Anything about C99 strict and whether the C in codechef is C89 or the earlier non-standardized original C – Aseem Bansal Commented Jun 20, 2013 at 7:05
- 6 This answer contains many errors. C99 is a standard defined by ISO around 1999. The C language has been internationally standardized for 23 years. Thus ANSI has nothing to do with it, they haven't touched a C standard in 24 years. Nowadays they merely print and distribute the ISO standard for the American market. – Lundin Commented Jun 20, 2013 at 9:21
- @Lundin Oh!! yeah , actually i wrote "defined" which is not the case,it should be "adopted" there.i made the correction,ANSI released the very first standard for C way back in 1989 which was adopted by ISO.after that almost all standards were released by ISO and adopted by ANSI, and the answer is brief as being asked,so i just mentioned few things keeping the answer short. – 0decimal0 Commented Jun 20, 2013 at 12:18
- 1 Note that gcc supports -std=c89 and -std=gnu89 and -std=c99 and -std=gnu99 (and modern enough versions support -std=c11 and -std=gnu11). The difference is to do with extensions over the Standard C being available automatically or only when the source prods the compiler into providing them with appropriate macros (such as -D_XOPEN_SOURCE=700). – Jonathan Leffler Commented Jun 23, 2013 at 6:27
Your Answer
Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Draft saved Draft discardedSign up or log in
Sign up using Google Sign up using Email and Password SubmitPost as a guest
Name EmailRequired, but never shown
Post Your Answer DiscardBy clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged
or ask your own question.- The Overflow Blog
- Your docs are your infrastructure
- Featured on Meta
- More network sites to see advertising test [updated with phase 2]
- We’re (finally!) going to the cloud!
Linked
636 How to initialize a struct in accordance with C programming language standards 131 How does the below program output `C89` when compiled in C89 mode and `C99` when compiled in C99 mode? 44 List of standard header files in C and C++ 33 ANSI C vs other C standards 17 Is C99 backward compatible with C89? 18 Compatibility of C89/C90, C99 and C11 12 Initializing bit-fields 2 In C, should I define (not declare/prototype) a function that takes no arguments with void or with an empty list? 4 How can I understand what standard my libraries are and to what standard gcc compiles in my computer? 3 STM32 HAL C standard See more linked questionsRelated
48 What are the major differences between ANSI C and K&R C? 177 Difference between CC, gcc and g++? 33 ANSI C vs other C standards 16 Are there any differences between ANSI C and ISO C? 63 What's the difference between GNU99 and C99 (Clang)? 4 What's the term *ANSI C* specifies if it used with GNU89, C89, GNU99, C99? 0 Difference between C and C++ 3 Difference between GCC's GNU C standards and ANSI C? 2 What is the difference between the "c99" and "gcc" commands with appropriate flags? 0 List of ANSI C and C99 literal prefixes and suffixesHot Network Questions
- Burned washing machine plug
- How to change the numeration of sections from "0.x" to "1", "2", etc.?
- range has lost one leg of 220
- cartridge style bottom bracket temperature range
- Reality check: energy source for power armour
- Are garbage-collection programming languages inherently unsafe for use in cryptography
- How do you write a page-centered abstract in a two column document
- What happened to the lifeboats in Star Trek: First Contact?
- Can Martial Characters use Spell Scrolls in D&D 2024?
- Is Trinitarian Christian theism a simple hypothesis?
- How to delete faces that intersect an edge with geometry nodes?
- Did anything ever use the -12V line on the original PC power supply?
- Does length contraction "break the speed limit"?
- Non-reflexive use of laisser without a direct object in « The Stranger » ?
- Arrange 3 red balls and 33 white balls randomly in a circle. What is the probability that there are no more than 13 consecutive white balls?
- Have import tariffs ever been good for an economy historically?
- Why did Satan take Jesus to the Temple to jump down from?
- Routing fastest route with weighted paths in QGIS
- How to distinguish interaction from mediation?
- Why does Japanese not have a native "tu" sound?
- Can this strong directional blur at wide apertures still be explained by the usual arguments?
- How can I prevent a redirect loop with iptables when running a local forward proxy?
- Why is Ukraine's conscription age (still) so high (25)?
- Does the 90 day window for VWP reset for extended stay in Mexico?
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
lang-cTừ khóa » C99 C
-
C99 - Wikipedia
-
[PDF] An Introduction To The C99 Programming Language - Dartmouth CS
-
C99 Features - W3schools
-
What Is C99 In The C Programming Language? - Quora
-
Introduction To The C99 Programming Language : Part I
-
C99
-
C99 Features In GCC On Fedora
-
C99 - The Open Group Publications Catalog
-
C99 (Analysis Of Some Aspects Of The C99 Standard)
-
C99 Features As Extensions To C89 - IBM
-
[PDF] Contents - Open-std
-
[PDF] Rationale For International Standard— Programming Languages— C
-
Does Visual Studio 2019 Fully Support C99 Standard For C Code ...
-
C99—A Brief Introduction - C Programming Essentials [Book] - O'Reilly