Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Please, describe you experience of using Microsoft C++/CLI [closed]

Tags:

.net

clr

c++-cli

C++/CLI is very powerful language. It's the only CLR language where you can seamlessly combine managed and unmanaged code. How many software developers (on this site) are using this language? In what kind of projects do you use it? Is it an adapting of legacy code or creation of an original software? Can you compare old Managed C++ with new C++/CLI? What do you think about the current quality and about the future of C++/CLI?

like image 242
macropas Avatar asked Apr 01 '09 07:04

macropas


1 Answers

I've used it to write thin layers of integration between managed and native code. That's all though.

The best known unique feature of it is the ability to seamlessly delve into unmanaged code and modify (or accidentally corrupt) any bit of writeable memory in the entire process - that's not an advantage in general programming, but when you need it, it's great. But I think I'm going to need it less and less. You can compile C++/CLI with a /pure flag, but then it really becomes a completely new language.

There are two other big unique features though:

  • Destructors that do something useful. In C# a destructor is a finalizer. In C++ it is a proper deterministically-called destructor. This means that C++/CLI has the most complete infrastructure for working with IDisposable. C# only helps clients (through the using statement), but only C++/CLI helps implementors as well. I'm hopeful that perhaps one day C# will absorb this feature.

  • Duck-typing templates, which can be used along with CLI generics. Another thing that would be very useful in C#, although it could be made a lot more seamlessly without the historical baggage.

But C# is good enough without the last two things that I'm not tempted to use C++/CLI generally.

like image 168
Daniel Earwicker Avatar answered Oct 06 '22 21:10

Daniel Earwicker