1.2 Keywords

“Keywords” are words that have special meaning to the C compiler. In translation phases 7 and 8, an identifier cannot have the same spelling and case as a C keyword. (For a description of translation phases, see topic ; for information on identifiers, see topic .) The C language uses the following keywords:

autobreakcasecharconstcontinuedefaultdodoubleelseenumexternfloatforgotoifintlongregisterreturnshortsignedsizeofstaticstructswitchtypedefunionunsignedvoidvolatilewhile

You cannot redefine keywords. However, you can specify text to be substituted for keywords before compilation by using C preprocessor directives (see Chapter 7, “Preprocessor Directives and Pragmas”).

Microsoft Specific

The ANSI specification allows identifiers with two leading underscores to be reserved for compiler implementations. Therefore, the Microsoft convention is to precede Microsoft-specific keyword names with double underscores. For a description of the ANSI rules for naming identifiers, including the use of double underscores, see the next section. The Microsoft C version 7.0 compiler also recognizes the following keywords. These words cannot be used as identifier names. Note that there is a double underscore preceding each keyword.

__asm__based __cdecl__except __export__far __fastcall__finally __fortran __huge __inline__interrupt__loadds __near __pascal __saveregs__segment __segname __self __stdcall __try

Limited 32-bit support is available for __based. Seven of the above Microsoft-specific keywords are not supported in 32-bit compilations: __far, __fortran, __huge, __near, __segment, __segname, and __self. The __except and __finally keywords are not supported in 16-bit compilations.

For the Microsoft C compiler, extensions are enabled by default. You can make sure your program is fully portable by disabling the Microsoft extensions with the /Za command-line option. From within the Programmer's WorkBench, select Language Options and then C Compiler Options from the Options menu. Then select Additional Global Options from the C Compiler Options dialog box. Choose ANSI C in the Languages box; this disables the Microsoft extensions.¨