13

I saw there are such tokens in gcc's source code,

but how to use these 2 tokens?

assem
  • 3,023
  • 4
  • 20
  • 20

1 Answers1

21

__extension__:

GCC uses the __extension__ attribute when using the -ansi flag to avoid warnings in headers with GCC extensions. This is mostly used in glibc with function declartions using long long

__typeof__:

MIN and MAX in C is a good example how it's used. Basically it allows you to declare a variable which has the same type as another variable.

Community
  • 1
  • 1
ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
  • 1
    Can you provide an minified example that uses these 2 tokens? – assem Mar 16 '11 at 10:00
  • 2
    @assem ThiefMaster's answer should be more than good enough for you, unless you're trying to get someone else to do your homework. – Jim Balter Mar 16 '11 at 12:01
  • 3
    @assem: There is no magic here. If you get a warning that you use an extension to the language, you can either change you code or add `__extension__` to tell the compiler that you **intended** to write unportable code, and it doesn't have to tell you that again. Otherwise it is of no use. – Bo Persson Mar 16 '11 at 15:50
  • 2
    @assem: See [these clear examples](https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html) to understand extension. – Erfankam May 19 '14 at 23:45