/The GNU C Compiler (GCC) – I

The GNU C Compiler (GCC) – I

Let’s first talk a little bit about the C Standards and Diaclets
The First ANSI Standard for C was named C89 and it became an ISO Standard in 1990. Then some errors modifications were made on the C89 and the new standard became C99 and it has became an ISO in the same year.
some modifications were made to the C99 on 2001.
But what are those standards are for?
Standards were made for more portability. So no run-time problems happen once you try running your code on a platform that is different from the one you compiled your code on
How can you specify the standard you want to use in your GNU C Compiler?
since you are reading this article I think you should be familiar with GNU/Linux and the shells. and of course how commands work on the shells. Anyway, you can specify the Diaclet you want to use via gcc options. the first option to mention is std=%%% and that sets the language standard you are using.
another option is -traditional and that supports some of the K&R features.
yet another one is -funsigned-char and that option makes the compiler handle char variables as unsigned char which I dont see a very valuable option since those data-types can be used directly in the code..But hey we are just giving examples ;). and -fno-unsigned-char does exactly the oppsite.
-fno-asm disables using inline asm function in your code and inline functions and typeof keyword.
But…What have GCC or GNU C enabled us?
Frankly, GNU C have provided the C language a very precious features. Like:

  1. Local Labels
  2. Labels as a value
  3. Nesting Functions
  4. Typeof
  5. setting an array length to zero or variable
  6. passing variable number of arguments to macros
  7. supporting arthemtics on pointers
  8. inline functions
  9. function names
  10. return address

And much more than those But I have only mentioned the most important features.
Local Labels: –
defining and supporting local scopes for labels was a true amazing feature.
void a(void){
__label__ lbl;
int b = 2;
__label__ lbl;
goto lbl;
goto lbl;
in this function the local label lbl in the outer scope is very different than the one in the inner scope. so the compiler can discriminate between the lbl outside and the lbl inside and not pass into a conflict or return any errors. that’s an amazing feature indeed.
I think that is enough for this week. I will compelete that in another part.