什么是做100%控制的开发使用C ++ / CLI的优势是什么? [英] What are the advantages of doing 100% managed development using C++/CLI?

查看:193
本文介绍了什么是做100%控制的开发使用C ++ / CLI的优势是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是做的优势(可能的弊端的名单lenghtly) 100%的托管使用开发C ++ / CLI(即用的 / CLR:安全其中产生......组件,就像那些用C# )?尤其是当compard到C#(注意 C ++ / CLI:在C#和优势<一href="http://stackoverflow.com/questions/297323/is-there-any-advantage-to-using-c-cli-over-either-standard-c-or-c">Is有什么优势,使用C ++ / CLI通过任一标准的C ++或C#?大多是有关管理/非托管互操作)。

What are the advantages (the list of possible disadvantages is lenghtly) of doing 100% managed development using C++/CLI (that is, compile with /clr:safe which "generates ... assemblies, like those written in ... C#")? Especially when compard to C# (note C++/CLI : Advantages over C# and Is there any advantage to using C++/CLI over either standard C++ or C#? are mostly about managed/unmanaged interop).

例如,这里有一些我的头顶部:

For example, here are a few off the top of my head:

  • <一个href="http://stackoverflow.com/questions/2181846/how-can-i-get-close-to-non-nullable-types-in-c-today">C++-style对于托管类型引用,不是那样优雅盛放非空的引用,但有总比没有好或使用变通

  • C++-style references for managed types, not as elegant as full blown non-nullable references but better than nothing or using a work-around.

模板,更强大的比仿制药

templates which are more powerful than generics

preprocessor(这可能是一个缺点!不过宏对于code一代有用)

preprocessor (this may be a disadvantage!, but macros can be useful for code generation)

堆栈引用类型的语义 - 自动调用的的IDisposable :: Dispose()方法

stack semantics for reference types--automatically calling IDisposable::Dispose()

更​​容易实施的的Dispose()的通过C ++的析构函数

easier implementation of Dispose() via C++ destructor

C#3.0中加入自动实现属性,使不再是一个C ++ / CLI的优势。

C# 3.0 added auto-implemented properties, so that is no longer a C++/CLI advantage.

推荐答案

在C ++ / CLI,你可以在课后定义函数,你不能这样做,在C#。但我不知道这是否是一个优势。

In C++/CLI you can define functions outside of classes, you can't do that in C#. But I don't know if that is an advantage

这篇关于什么是做100%控制的开发使用C ++ / CLI的优势是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆