6.12.21 Alternate Keywords

-ansi and the various -std options disable certain keywords that are GNU C extensions. Specifically, the keywords asm, typeof and inline are not available in programs compiled with -ansi or a -std= option specifying an ISO standard that doesn’t define the keyword. This causes trouble when you want to use these extensions in a header file that can be included in programs that may be compiled with with such options.

The way to solve these problems is to put ‘__’ at the beginning and end of each problematical keyword. For example, use __asm__ instead of asm, and __inline__ instead of inline.

Other C compilers won’t accept these alternative keywords; if you want to compile with another compiler, you can define the alternate keywords as macros to replace them with the customary keywords. It looks like this:

#ifndef __GNUC__
#define __asm__ asm
#endif

-pedantic and other options cause warnings for many GNU C extensions. You can suppress such warnings using the keyword __extension__. Specifically:

__extension__ has no effect aside from this.