[转自己的文章]C++/CLI, a savior or a devil?

本文介绍了C++/CLI,它是微软Visual C++的最新测试版本,是C++与.NET平台(CLI)的集成。此前的Managed C++代码不美观且是.NET下的“二等语言”,很多程序员转用C#或放弃.NET。而C++/CLI让程序员在.NET环境有高度控制权,能以传统C++方式编程,仿佛C++回归.NET。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

C++/CLI is the latest version of Microsoft Visual C++ under beta.

Let me explain the name first: C++ is the programming language we all should be already familiar with; CLI stands for Common Language Infrastructure, aka. .NET platform, the "/" in the middle means the integration of C++ with CLI. It now uses some new keywords for managed coding, such as: String^ str = gcnew String("");

Originally in .NET 1.0 or 1.1, when Microsoft announced Visual C++.NET, a term "Managed C++" was introduced. "Managed" means we can create object that can be automatically deallocated from memory by GC. Since Managed C++ sticks very loyal to ISO C++, the code looks quite ugly: full with "__gc" stuff. What's more, it only counts for a "second-class" language under .NET. Many "traditional" Visual C++ programmers chose to switch to C#, a first-class language coming with .NET, or to abandon .NET or Microsoft platform completely.

That's when the idea of a new sort of Visual C++ come into sight. Created by Stan Lippman and Herb Sutter, C++/CLI provides programmers the ultimate control in .NET environment with a very high level of access to .NET class libraries, while at the same time allows the most "traditional" way of C++ programming.

Does this sound pleasing or annoying to you? To me, this is really cool, and makes me feel the "comeback" of C++ to .NET. And this is somewhat the same approach (spirit?) taken by C++ geeks when they introduced C++ in the dominance of C.

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值