C++ Keywords
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.
__box 2 |
|||
__gc 2 |
|||
__hook 3 |
|||
naked 1 |
|||
__nogc 2 |
noinline 1 |
||
noreturn 1 |
nothrow 1 |
novtable 1 |
|
__pin 2 |
|||
property 1 |
|||
__sealed 2 |
|||
thread 1 |
|||
__unhook 3 |
|||
uuid 1 |
|||
__value 2 |
|||
1 Extended attributes for the __declspec keyword.
2 Applicable to Managed Extensions for C++ only. This syntax is deprecated in Microsoft Visual C++ 2005.
3 Intrinsic function used in event handling.
See Language Features for Targeting the CLR for information on keywords that are new in Visual C++ 2005.
Microsoft Specific
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 __except, __finally, __leave, and __try are supported. In addition, __cdecl is available with no leading underscore.
The __asm keyword replaces C++ asm syntax. asm is reserved for compatibility with other C++ implementations, but not implemented. Use __asm.
The __based keyword has limited uses for 32-bit and 64-bit target compilations.