Skip to content

Latest commit

 

History

History
92 lines (66 loc) · 2.12 KB

identifier-cpp-cli.md

File metadata and controls

92 lines (66 loc) · 2.12 KB
description title ms.date ms.topic f1_keywords helpviewer_keywords ms.assetid
Learn more about: __identifier (C++/CLI)
__identifier (C++/CLI)
10/12/2018
reference
__identifier
__identifier_cpp
__identifier keyword [C++]
348428af-afa7-4ff3-b571-acf874301cf2

__identifier (C++/CLI)

Enables the use of C++ keywords as identifiers.

All Platforms

Syntax

__identifier(C++_keyword)

Remarks

Use of the __identifier keyword for identifiers that are not keywords is permitted, but strongly discouraged as a matter of style.

Windows Runtime

Requirements

Compiler option: /ZW

Examples

Example

In the following example, a class named template is created in C# and distributed as a DLL. In the C++/CLI 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();
}

Common Language Runtime

Remarks

The __identifier keyword is valid with the /clr compiler option.

Requirements

Compiler option: /clr

Examples

In the following example, a class named template is created in C# and distributed as a DLL. In the C++/CLI 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();
}

See also

Component Extensions for .NET and UWP
Component Extensions for .NET and UWP