Help - Search - Members - Calendar
Full Version: VB.NET, C#, OR C++
Hydrogenaudio Forums > Misc. > Off-Topic
JEN
QUOTE FROM http://dotnetjunkies.com/WebLog/darrell.no.../07/07/382.aspx

QUOTE
If you really want to get into truly advanced features and squeeze every last bit of power out of .NET, then you'd want to look at C++ and the managed extensions for .NET. Otherwise, in the grand scheme of things, it just doesn't matter one way or the other.


Does this mean that c++ is still the best, compared to vb.net and c#? Im not talking about any other language, i.e. assembly (00110011010) etc
niktheblak
In this case "best" is a very ambiguous and difficult term.

If speaking in the context of .NET framework, where Managed C++ code is compiled into MSIL instead of native code, I'd say that Managed C++ has very little advantage over VB.NET and C#. Dealing with unmanaged C/C++ code is easier though.

In general terms however, C++ code can be compiled to native code, which can be faster than JITted (MSIL) code on certain circumstances. With C++ it's possible to do some extreme performance tuning (for instance via templatized code, inlined functions and inline assembler) that is not possible directly with VB.NET or C#. I think this is what the article you quoted is referring to.

If operating within .NET framework, Managed C++ can be used to optimize critical parts of the application. It can also be used to interface with legacy C/C++ code.

Also, plain (non-.NET) C++ programs are easier to distribute since they don't require the .NET Framework runtime. But this is also valid for C, VB, Delphi, D, Obj-C and so on and so on. In theory, C++ is also very portable, much more so than .NET applications.

A simple answer to "is C++ better than C#, VB.NET etc" is impossible to give. Generally the heavy-duty "C++ optimizations" can be done in .NET environment, either by using Managed C++ or by calling native code from DLL's via P/Invoke. C# and VB.NET are a lot cleaner and nicer languages than C++, and they are also a lot easier to learn throughly.

I leave you with a blatantly obvious, low-SNR answer: C++ is optimal for certain tasks and unoptimal for others. So are C#, VB.NET, Java, Python etc. Programming languages are tools. You should choose the right tool for the job.

Edit:

Given the current situation in computer hardware and CPU architecture, "optimization" is becoming an increasingly difficult concept. The old C-style *q++ = *p++ tricks just won't work anymore. So, I'd say that is totally possible to write extremely efficient code with C#/MSIL, in some cases it's even faster than well-written compiled C++ code.

So, where does that put C/C++ to? To where they belong, operating systems, embedded systems and obscure platforms tongue.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.