Is C++ still a viable language?

Every so often someone in microsoft.public.dotnet.languages.vc asks about the future of C++, or if he should learn C# or VB.NET instead of C++. Some people are also confused if using C++ means they carry around C++ legacy code if they want to write pure .NET apps.


 


With C++ you can write pure .NET apps that have absolutely no legacy luggage whatsoever. On the contrary, you can write .NET apps and still use powerful features like templates. Another advantage is that the next version of VC++ will be able to compile for different .NET platforms (2.0 and higher).


You can also reuse native C++ code and libraries and create mixed mode applications. C++/CLI is the only language that allows you to do this.


But I have also learned C# and .NET, and I have used it since version 1.0 was released. I use it fairly often. In fact, at work I use it as much as possible.


C# comes with a lot of stuff that makes programming a lot easier and less time consuming. I love C++ but I admit that C++ does not hold a candle to C# when it comes to rapid application development.


But C++ is still the only viable option for scenarios where you need absolute control over memory and real-time performance. Interoperability with other code is also a strong area for C++ where C# wimps out. Raw performance also makes a difference when you are writing a piece of code that has to crunch through 300 MB of code to do some image processing for example. 95% of all large code bases are still native C++. Vista is completely native as well, so C++ is not going away anytime soon.


My reason for choosing C# for pure .NET applications is that it is easier to learn, easier to maintain, and less effort to create an application. And C# and VB will also have support for LINQ, and lots of other cool new features that are not planned for C++ at the moment. And by now there are more good C# programmers than C++ programmers. It is far easier to transfer ownership of a C# project.


I would not touch VB.NET with a 10 foot pole because I think VB is evil incarnate, and the syntax is too verbose and ugly as hell. But that is just my personal preference of course. Most people in the C++ forums would agree.


People in the VB forums may have a different opinion of course.


Anyway, if you want to do .NET programming, learn C#. If you want to do C++ programming, learn C# and C++ and the low level stuff like marshalling and interop. If you want to do C++ programming in the windows world, knowing only native C++ will not suffice anymore in most cases.


C++ is about power and flexibility. C# is about getting the job done with as little fuss and effort as possible. Both have their place.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>