tags:

views:

73

answers:

3

Has anyone tried coding in managed C++? I have a few questions :

  1. How productive is the language compared to C#?
  2. Is there any restriction on type of projects that can be written? Can we write a web application in managed C++?
  3. Is it possible to mix managed and unmanaged C++ code in one application?
  4. Is MFC still valid in managed C++? Will it be the best option when considering migration of a VC++ application?
+1  A: 

I think C# is far better to work with in a managed environment. Managed C++ just seems kind of kludgey to me and I'd much rather work with a language that is meant for a managed environment (not that managed c++ won't work). Furthermore, if you need to, you can call unmanaged code from C# just as you can from managed C++.

Miguel Sevilla
+1  A: 

I've found C# to be far more productive. The real magic of managed C++ is that yes, you can mix managed and unmanaged code in it - even inside one function! I don't know how Microsoft did that (and apparently neither do they, because the official name for this feature is "IJW" - "it just works" :)).

Evgeny
Just to supplement our point, in C# you can also mixed managed and unmanaged code inside the same function. It is a feature of the framework.
Miguel Sevilla
How do you do that in C#? You can use P/Invoke, of course, but you cannot *just write the code*, as if it were a native program, as you can in C++/CLI.
Evgeny
+2  A: 

I've used managed C++ (C++/CLI) as a bridge between C# and C++. We had a graphical application that used OpenSceneGraph as the 'bottom' layer. Managed C++ was then used in between to grab some of the graphical data as well as interface between the C# and the OSG layers.

It worked pretty darn well in that particular application. However, I would prefer straight C#.

Robb