Inisheer
Inisheer

Reputation: 20794

Would you use C++/CLI if supported like C# & VB.NET?

I've always had a thing for C++/CLI. Maybe because not many developers use it... or just because it's different.

Suppose Microsoft fully supported C++/CLI as they do VB.NET and C# (ie. LINQ, WPF, etc.). Would you use it?

If not, why?

Upvotes: 3

Views: 1205

Answers (8)

Anton K
Anton K

Reputation: 4798

I use it to support legacy code as well as writing shims between managed and native code. Love that VS11 supports it much better

Upvotes: 0

DougN
DougN

Reputation: 4607

I would not use it because I don't want to be tied to a huge run-time. And I don't like all those ^ pointer thingys :)

I do like/miss the great library that .NET offers though.

Upvotes: 1

Motti
Motti

Reputation: 114695

...but I'm not entirely clear on what C++/CLI offers that C# does not. -- @Thomas Owens

One huge benefit (in my book) is RAII (see the answer given by Adam Wright to my question regarding RAII in .NET).

Upvotes: 4

Jared Updike
Jared Updike

Reputation: 7277

C++/CLI delivers very effectively on the promise of uniting Managed and Unmanaged code. It lets you expose what feels like a perfectly native C# library with 100% access to native C++/libraries "on the inside". It's not an exercise in elegance but in the history of practical programming tools what compares?

If you need LINQ and WPF, just use C#. That's the beauty of C++/CLI: write your Managed wrapper and then go back to C#. I don't see C++/CLI intending to replace C# for day to day use.

Upvotes: 4

Jeff Yates
Jeff Yates

Reputation: 62367

It's all about using the right tool for the right job. I use C++/CLI for platform interop work because it's much easier to get the marshaling correct. I use C# for almost all other .NET work, with some VB.Net (I like the inline XML). I admit I haven't learned IronRuby, IronPython, F#, or any other .NET language yet, but I'm seriously considering it just to increase my programming arsenal.

To answer the question, I don't think I'd use it anymore than I already do because I feel I already use it for the jobs it fits best. C# is still the best .NET language as I see it because it was specifically designed for that platform, rather than shoehorning an older language to fit it. Adding better support for C++/CLI would only decrease my development time, rather than sway my usage from another language.

Upvotes: 5

Daniel A. White
Daniel A. White

Reputation: 190907

I am mixing C++/CLI with MFC to take advantage of the WPF and XAML, but I am using the new C++ 2008 feature pack -- free ribbon components. :)

Upvotes: 1

Shog9
Shog9

Reputation: 159590

I do use it. Even with the relative lack of tool support, it still beats raw P/Invoke for dealing with Win32.

As for LINQ, i don't really care to see too much more hacked into the C++ language. LINQ is usable enough as-is - if they're gonna enhance the compiler, they should work on C++ 0x support...

Upvotes: 14

Thomas Owens
Thomas Owens

Reputation: 116161

Perhaps...but I'm not entirely clear on what C++/CLI offers that C# does not. Pointers, perhaps? I've done all of my .NET programming (the little I've done) in C#, and I'm starting to learn F#, but if it was fully supported and well documented, sure, I would give it a go.

Upvotes: 1

Related Questions