The latest version of this topic can be found at Keywords (C++).
Keywords are predefined reserved identifiers that have special meanings. They cannot be used as identifiers in your program. The following keywords are reserved for Microsoft C++. Names with leading underscores are Microsoft extensions.
1 Extended attributes for the
2 Applicable to Managed Extensions for C++ only. This syntax is now deprecated.
3 Intrinsic function used in event handling.
See Component Extensions for Runtime Platforms for more information.
In Microsoft C++, identifiers with two leading underscores are reserved for compiler implementations. Therefore, the Microsoft convention is to precede Microsoft-specific keywords with double underscores. These words cannot be used as identifier names.
Microsoft extensions are enabled by default. To ensure that your programs are fully portable, you can disable Microsoft extensions by specifying the ANSI-compatible /Za command-line option (compile for ANSI compatibility) during compilation. When you do this, Microsoft-specific keywords are disabled.
When Microsoft extensions are enabled, you can use the Microsoft-specific keywords in your programs. For ANSI compliance, these keywords are prefaced by a double underscore. For backward compatibility, single-underscore versions of all the double-underscored keywords except
__try are supported. In addition,
__cdecl is available with no leading underscore.
__asm keyword replaces C++
asm is reserved for compatibility with other C++ implementations, but not implemented. Use
__based keyword has limited uses for 32-bit and 64-bit target compilations.