questions about C language dialects in Xcode and C standards in general
From what I understand, besides K&R, which was more of a de facto standard before there was an official C standard, the first standard was established by ANSI and ratified in 1989, and became known as the C89 standard (commonly referred to as ANSI C). Then, a year later, in 1990, ISO adopted the standard, establishing what became known as the C90 standard (sometimes referred to as ISO C). Finally, almost a decade later, in 1999, ANSI readopted the ISO C90 standard, established the C99 standard, which is the current standard for the C language. This brings up a few questions:
First off, if you examine the options for the C Language Dialect setting in Project Settings in Xcode, you'll see a few choices: ANSI C, C89, GNU89, C99, GNU99, and Compiler Default. So...
1.) What's up with the Compiler Default option? Does this vary from system to system (could it be different on your computer than on mine)? Xcode always uses the same compiler (GCC, right?) no matter what computer it's on, so shouldn't the Compiler Default setting be the same on any computer? How's that work?
2.) There are two seemingly identical options: ANSI C and C89. Technically, of course, any ANSI C standard (C89 or C99) could be considered ANSI C, but specifically, the term ANSI C is used to refer to the C89 standard -- I've read from numerous sources ("Learn C on the Mac" is the one I have in front of me at the moment). So, then, what would be the difference between the ANSI C dialect option and the C89 dialect option?
3.) What's the deal with the ISO standard (C90) not being included in these options? Is it just similar enough to either C89 or C99 that they didn't feel it was necessary to include, or is there some other reason?
4.) With the exception of Compiler Default and the ANSI C options, each option has a GNU version. So, in addition to the C89 dialect option, they also have the GNU89 dialect option, and in addition to the C99 dialect option, they also have the GNU99 dialect option. These (GNU89 and GNU99) aren't actual established standards like C89 and C99, are they? I assume they are just options for the dialect. So, what are they? What's the difference between them and their C counterparts (GNU89 vs. C89 and GNU99 vs. C99)?
5.) How exactly do these options affect your project, or your code in specific. For example, I believe C++-style comments (the // comments) weren't brought into the C standard until C99. I think this is correct, but whether it is or not, let's assume it is for the sake of this question. So, I'm guessing that if I set the C Language Dialect option to C99 and try to use a C++ comment then all will be well, but if I set the option to C89 and try the same thing then I will get an error -- is this right? I would test it myself, but like I said, I'm not positive that I'm correct about C++ comments being introduced to the standard with C99. So, if this is right, then you'll be more restricted with your code by setting the option to C89 than you would be by setting it to C99, right? So if I wrote code with the option set to C99 and used some of the features of language that were added to the C standard with C99 and not before that, it would work fine, but if I then needed to give the code to someone else for them to edit it, and if they were using a compiler that used to original ANSI C (C89) standard, then they would get a bunch of errors and have to edit the code, right? For this reason, might it be a good idea for me to get in the habit of programming C with the language dialect option set to C89 (or ANSI C -- again, not sure why both are there or what the difference is).
So, that wraps up my questions about the C Language Dialect option, and there's only a few more things I wanted to ask about standards in general:
6.) I'm not really clear on exactly what a standard actually is or what it does in terms of the C language. When they establish a new standard for the C language, what exactly happens to the language? Does the language itself actually change? Do they change the built-in language elements (the syntax and structure and keywords and all that) to correspond to the new standard? Or is it more of just a declaration of how people are supposed to program C under the standard? I'm not sure if that made sense, but I just wanted to try to understand the nature of standards for the C language a little better and how, exactly, they contribute to or alter the language.
7.) Does anyone know if there's been any talk of a new standard, or are we going to be under the C99 standard for the foreseeable future? Being a more low-level language, maybe C is more self-sufficient and they don't feel the need to make changes to the languageOr maybe that makes no sense.
Sorry, guys -- I know this was a long one, and the issues I asked about aren't particularly important I guess, so I'm not really expecting anyone to give a comrehensive response answering all my questions in full detail -- just any input on anything here will be greatly appreciated. Thanks in advance!
8.) On that note,
MacBook, Mac OS X (10.5.8)