If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

[RESOLVED] C++/CLI and C#

When it comes to developing Windows Forms Applications, what is more powerful out of C++/CLI and C#?Microsoft state on MSDN that C++/CLI is the most powerful .NET Language,but i wish to know what makes it more productive and powerful than C#.
I have also been told that C++/CLI Applications run faster than C# ones, is this true?I dont understand how a C++/CLI Application can run faster than a C# Application when .NET Languages are supposed to be compiled to MIL and run at the same speed

Re: C++/CLI and C#

Hi,

Both languages are about equally powerful in this context. The biggest strength of C++ is evident when you need to also use OS functionality that is only exposed as native or COM APIs since you can just call them. The biggest strength of C# is that it is a simpler language with a build model that allows for easier tools support.

C++/CLI code tends to be faster for 2 different reasons:
1) Writing identical code and running it on x86 is up to a few percent faster in some cases because we run the optimizer when emitting MSIL code to compensate for some analysis the x86 JIT compiler is not able to do. On x64 the difference is less.
2) Some patterns that are much more natural in C++/CLI like using our deterministic finalization avoid putting undue pressure on the garbage collector and in some cases that can have dramatically positive performance effects. In C#you can obtain the same effect through using blocks or by explicitely calling Dispose in a finally clause, but that code is not the natiral way to write it in C#.