title | ms.custom | ms.date | helpviewer_keywords | ms.assetid | |
---|---|---|---|---|---|
Keywords (C++) |
index-page |
10/10/2018 |
|
d7ca94a8-f785-41ce-9f73-d3c4fd508489 |
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, and names followed by (C++/CLI) are Microsoft extensions.
1 Extended attributes for the __declspec keyword.
2 Applicable to Managed Extensions for C++ only. This syntax is now deprecated. See Component Extensions for Runtime Platforms for more information.
3 Intrinsic function used in event handling.
4 For backward compatibility with previous versions, these keywords are available both with two leading underscores and a single leading underscore when Microsoft extensions are enabled (the default).
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 /Za (Disable language extensions) option during compilation. When you do this, some 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 many of the double-underscored keywords 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.
END Microsoft Specific
Lexical Conventions
C++ Built-in Operators, Precedence and Associativity