gcc: Alternate Keywords
1
1 6.46 Alternate Keywords
1 =======================
1
1 '-ansi' and the various '-std' options disable certain keywords. This
1 causes trouble when you want to use GNU C extensions, or a
1 general-purpose header file that should be usable by all programs,
1 including ISO C programs. The keywords 'asm', 'typeof' and 'inline' are
1 not available in programs compiled with '-ansi' or '-std' (although
1 'inline' can be used in a program compiled with '-std=c99' or
1 '-std=c11'). The ISO C99 keyword 'restrict' is only available when
1 '-std=gnu99' (which will eventually be the default) or '-std=c99' (or
1 the equivalent '-std=iso9899:1999'), or an option for a later standard
1 version, is used.
1
1 The way to solve these problems is to put '__' at the beginning and end
1 of each problematical keyword. For example, use '__asm__' instead of
1 'asm', and '__inline__' instead of 'inline'.
1
1 Other C compilers won't accept these alternative keywords; if you want
1 to compile with another compiler, you can define the alternate keywords
1 as macros to replace them with the customary keywords. It looks like
1 this:
1
1 #ifndef __GNUC__
1 #define __asm__ asm
1 #endif
1
1 '-pedantic' and other options cause warnings for many GNU C extensions.
1 You can prevent such warnings within one expression by writing
1 '__extension__' before the expression. '__extension__' has no effect
1 aside from this.
1