Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Keywords (C++)

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

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.

__abstract 2__alignof Operator__asm
__assume__based__box 2
__cdecl__declspec__delegate 2
__event__except__fastcall
__finally__forceinline__gc 2
__hook 3__identifier__if_exists
__if_not_exists__inline__int16
__int32__int64__int8
__interface__leave__m128
__m128d__m128i__m64
__multiple_inheritance__nogc 2__noop
__pin 2__property 2__raise
__sealed 2__single_inheritance__stdcall
__super__thiscall__try/__except, __try/__finally
__try_cast 2__unaligned__unhook 3
__uuidof__value 2__virtual_inheritance
__w64__wchar_t, wchar_tabstract
arrayautobool
breakcasecatch
charclassconst
const_castcontinuedecltype
defaultdelegatedelete
deprecated 1dllexport 1dllimport 1
dodoubledynamic_cast
elseenumenum class
enum structeventexplicit
externfalsefinally
floatforfor each, in
friendfriend_asgcnew
genericgotoif
initonlyinlineint
interface classinterface structinterior_ptr
literallongmutable
naked 1namespacenew
newnoinline 1noreturn 1
nothrow 1novtable 1nullptr
operatorprivateproperty
property 1protectedpublic
ref classref structregister
reinterpret_castreturnsafecast
sealedselectany 1short
signedsizeofstatic
static_assertstatic_caststruct
switchtemplatethis
thread 1throwtrue
trytypedeftypeid
typeidtypenameunion
unsignedusing declaration, using directiveuuid 1
value classvalue structvirtual
voidvolatilewhile

1 Extended attributes for the __declspec keyword.

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 __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.

Lexical Conventions
C++ Operators

Show:
© 2017 Microsoft