title | ms.custom | ms.date | ms.reviewer | ms.suite | ms.technology | ms.tgt_pltfrm | ms.topic | f1_keywords | dev_langs | helpviewer_keywords | ms.assetid | caps.latest.revision | author | ms.author | manager | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
__identifier (C++/CLI) | Microsoft Docs |
11/04/2016 |
|
language-reference |
|
|
|
348428af-afa7-4ff3-b571-acf874301cf2 |
18 |
mikeblome |
mblome |
ghogen |
Enables the use of Visual C++ keywords as identifiers.
Syntax
__identifier(
Visual_C++_keyword
)
Remarks
Use of the __identifier
keyword for identifiers that are not keywords is permitted, but strongly discouraged as a matter of style.
Compiler option: /ZW
Example
In the following example, a class named template
is created in C# and distributed as a DLL. In the Visual C++ program that uses the template
class, the __identifier
keyword conceals the fact that template
is a standard C++ keyword.
// identifier_template.cs
// compile with: /target:library
public class template {
public void Run() { }
}
// keyword__identifier.cpp
// compile with: /ZW
#using <identifier_template.dll>
int main() {
__identifier(template)^ pTemplate = ref new __identifier(template)();
pTemplate->Run();
}
Remarks
The __identifier
keyword is valid with the /clr compiler option.
Compiler option: /clr
Example
In the following example, a class named template
is created in C# and distributed as a DLL. In the Visual C++ program that uses the template
class, the __identifier
keyword conceals the fact that template
is a standard C++ keyword.
// identifier_template.cs
// compile with: /target:library
public class template {
public void Run() { }
}
// keyword__identifier.cpp
// compile with: /clr
#using <identifier_template.dll>
int main() {
__identifier(template) ^pTemplate = gcnew __identifier(template)();
pTemplate->Run();
}
Component Extensions for Runtime Platforms
Component Extensions for Runtime Platforms